private void AcceptBtnClick(object sender, RoutedEventArgs e) { using (var context = new HwContext()) { var user = context.Users.ToList()[0]; if (fullNameTB.Text != string.Empty) { user.FullName = fullNameTB.Text; } if (hobbiesTB.Text != string.Empty) { user.HobbyList = hobbiesTB.Text; } if (loginTB.Text != string.Empty) { user.Login = loginTB.Text; } if (user.ImagePath != profileImage.Source.ToString()) { user.ImagePath = profileImage.Source.ToString(); } context.Update(user); context.SaveChanges(); } }
public MainWindow() { InitializeComponent(); using (var context = new HwContext()) { user = context.Users.ToList()[0]; } ShowInfo(); }