public void Remove(int id) { Entities.Size size = context.Sizes.FirstOrDefault(s => s.ID == id); if (size is not null) { context.Remove(size); context.SaveChanges(); //context.ChangeTracker.Clear(); } }
public void Remove(int id) { Entities.Topping topping = context.Toppings.FirstOrDefault(t => t.ID == id); if (topping is not null) { context.Remove(topping); context.SaveChanges(); //context.ChangeTracker.Clear(); } }
public void Remove(int id) { Entities.Crust crust = context.Crusts.FirstOrDefault(c => c.ID == id); if (crust is not null) { context.Remove(crust); context.SaveChanges(); //context.ChangeTracker.Clear(); } }
public void Remove(int id) { Store existingStore = context.Stores.FirstOrDefault(store => store.ID == id); if (existingStore is not null) { context.Remove(existingStore); context.SaveChanges(); //context.ChangeTracker.Clear(); } }
public void Remove(int id) { Pizza pizza = context.Pizzas.FirstOrDefault(p => p.ID == id); if (pizza is not null) { context.Remove(pizza); context.SaveChanges(); //context.ChangeTracker.Clear(); } }
public void RemoveStore(int id) { var storeTemp = db.Stores.FirstOrDefault(s => s.StoreId == id); if (storeTemp.StoreId == id) { db.Remove(storeTemp); db.SaveChanges(); } else { Console.WriteLine($"User with ID {id} does not exist"); return; } }
public void RemovePresetPizza(int id) { var presetTemp = db.PresetPizzas.FirstOrDefault(p => p.PresetId == id); if (presetTemp.PresetId == id) { db.Remove(presetTemp); db.SaveChanges(); } else { Console.WriteLine($"Preset pizza with ID {id} does not exist"); return; } }
public void RemoveUser(int id) { var userTemp = db.Users.FirstOrDefault(u => u.UserId == id); if (userTemp.UserId == id) { db.Remove(userTemp); db.SaveChanges(); } else { Console.WriteLine($"User with ID {id} does not exist"); return; } }
public void RemoveCrust(int id) { var crustTemp = db.CrustTypes.FirstOrDefault(c => c.CrustId == id); if (crustTemp.CrustId == id) { Console.WriteLine($"Removing crust type with ID {id}..."); db.Remove(crustTemp); db.SaveChanges(); Console.WriteLine($"Crust type with ID {id} removed successfully"); } else { Console.WriteLine($"Crust type with ID {id} does not exist"); return; } }
public void RemoveOrder(int id) { var orderTemp = db.Orders.FirstOrDefault(o => o.OrderId == id); if (orderTemp.OrderId == id) { Console.WriteLine($"Removing order with ID {id}..."); db.Remove(orderTemp); db.SaveChanges(); Console.WriteLine($"Order with ID {id} removed successfully"); } else { Console.WriteLine($"Order with ID {id} does not exist"); return; } }
public bool DeleteAddress(Address a) { _db.Remove(a); return(_db.SaveChanges() == 1); }