private void NewTask_Click(object sender, RoutedEventArgs e) { var dialog = new NewTask(null); dialog.Title = "Новая задача"; if (dialog.ShowDialog() == true) { ReloadTasks(); } }
private void Edit_Click(object sender, RoutedEventArgs e) { var dialog = new NewTask(Task); dialog.Title = "Редактировать задачу"; if (dialog.ShowDialog() == true) { using (var db = new OrganizerContext()) { db.Tasks.AddOrUpdateExtension(Task); db.SaveChanges(); ParentWindow.ReloadTasks(); } } }