public ActionResult <MenuItemReadDto> DeleteTables(int id) { var tableModelFromRepo = _tableRepo.GetElementById(id); if (tableModelFromRepo == null) { return(NotFound()); } _tableRepo.DeleteTable(tableModelFromRepo); _tableRepo.SaveChanges(); return(NoContent()); }
public void Delete() { if (!ManipulatedTable.IsOccupied) { if (MessageBoxResult.Yes == MessageBox.Show(Properties.Resources.ConfirmationRemoveTable, Properties.Resources.ConfirmationRemoveTableCaption, MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No)) { Data.Table dataTable = Tables.FirstOrDefault(x => x.Id == ManipulatedTable.Id); _tablesRepository.DeleteTable(dataTable); ToTableViewRequested?.Invoke(); } } else { ErrorHandler.ThrowError(0, Properties.Resources.CannotRemoveOccupiedTable); } }