public bool DeleteOrder(int id) { try { if (id > 0) { Order order = POS.Orders.FirstOrDefault(x => x.Id == id); if (order != null) { var query = POS.OrderItems.Where(x => x.OrderId == order.Id).ToList(); if (query.Count() > 0) { foreach (var item in query) { var querys = POS.OrderItemTags.Where(x => x.OrderItemId == item.Id).ToList(); if (querys.Count() > 0) { querys.ForEach(x => POS.OrderItemTags.Remove(x)); } } query.ForEach(x => POS.OrderItems.Remove(x)); } POS.Orders.Remove(order); POS.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }
public bool DeleteRoom(int id) { try { if (id > 0) { RoomManagement room = POS.RoomManagements.FirstOrDefault(x => x.Id == id); if (room != null) { POS.RoomManagements.Remove(room); POS.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }
public bool DeleteItem(int id) { try { if (id > 0) { Tag tag = POS.Tags.FirstOrDefault(x => x.id == id); if (tag != null) { POS.Tags.Remove(tag); POS.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }
public bool DeleteCategory(int id) { try { if (id > 0) { Category category = POS.Categories.FirstOrDefault(x => x.Id == id); if (category != null) { POS.Categories.Remove(category); POS.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }
public bool DeleteItem(int id) { try { if (id > 0) { Item item = POS.Items.FirstOrDefault(x => x.Id == id); if (item != null) { POS.Items.Remove(item); POS.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }
public bool DeleteTable(int id) { try { if (id > 0) { TableManagement table = posDatabase.TableManagements.FirstOrDefault(x => x.Id == id); if (table != null) { posDatabase.TableManagements.Remove(table); posDatabase.SaveChanges(); } } return(true); } catch (Exception e) { throw e; } }