private void RemoveButton_Click(object sender, RoutedEventArgs e) { var msgResult = MessageBox.Show("Bạn chắc chắn muốn xoá - " + SelectedCake.Name, "Cake Shop", MessageBoxButton.YesNo, MessageBoxImage.Question); if (msgResult == MessageBoxResult.Yes) { var del = CakeDAO.Delete(SelectedCake.ID); if (del != 0) { EndEditing.Invoke(SelectedCake, EditingStyle.Delete); Close(); } else { MessageBox.Show("Xoá thất bại!\nVui lòng thử lại sau", "Cake Shop", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void UpdateCake(DependencyObject sender, Cake cake) { if (sender != null) { GetWindow(sender).Close(); } cake.ID = SelectedCake.ID; var update = CakeDAO.Update(cake); if (update == true) { SelectedCake = cake; cakeDetail.DataContext = SelectedCake; EndEditing.Invoke(SelectedCake, EditingStyle.Update); } else { MessageBox.Show("Lưu thất bại!\nVui lòng thử lại sau", "Cake Shop", MessageBoxButton.OK, MessageBoxImage.Error); } }
public override void EditingEnded(NSNotification notification) { EndEditing?.Invoke(notification.Object, EventArgs.Empty); }