private void DeleteAppartment() { if (this.selectedAppartment != null) { context.DeleteAppartment(selectedAppartment.AppartmentId); context.DataContext.SaveChanges(); Appartments.Remove(selectedAppartment); selectedAppartment = null; } }
private void DropAppartment(object param) { if (!WinApiMessageBox.ConfirmAction("Удалить данную квартиру?")) { return; } _context.Appartments.Remove(SelectedAppartment.Appartment); _context.SaveChanges(); Appartments.Remove(SelectedAppartment); OnPropertyChanged("Appartments"); DropAppartmentOption = SelectedAppartmentVisibility = Visibility.Collapsed; SearchBarVisibility = Visibility.Visible; }