Redact.xaml.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. using System.Xml.Linq;
  16. namespace SneakersSkakunov
  17. {
  18. /// <summary>
  19. /// Логика взаимодействия для Redact.xaml
  20. /// </summary>
  21. public partial class Redact : Window
  22. {
  23. Sniker snk = new Sniker();
  24. Users user = new Users();
  25. public Redact(int UsId)
  26. {
  27. InitializeComponent();
  28. user = snk.Users.Where(x => x.id_Users == UsId).FirstOrDefault();
  29. fam.Text = user.Surname;
  30. imya.Text = user.Name;
  31. otch.Text = user.Patronymic;
  32. BirthDate.SelectedDate = user.DateBirth;
  33. }
  34. private void Edit(object sender, RoutedEventArgs e)
  35. {
  36. user.Surname = fam.Text;
  37. user.Name = imya.Text;
  38. user.Patronymic = otch.Text;
  39. user.DateBirth = BirthDate.SelectedDate;
  40. snk.SaveChanges();
  41. MainFrame.mframe.Navigate(new UserPage(user.id_Users));
  42. MessageBox.Show("Изменения сохранены");
  43. }
  44. private void Back(object sender, RoutedEventArgs e)
  45. {
  46. this.Close();
  47. }
  48. }
  49. }