public static void InitDatabase() { // Init DB CustomerDAL.initData(); PastryDAL.initData(); BranchDAL.initData(); OrderdDAL.initData(); }
public static void DeleteCustomer(string customerIDToRemove) { //using (PastryContext Contexts.DB = new PastryContext()) { var customer = GetCustomer(customerIDToRemove); OrderdDAL.DeleteAllRelatedOrders(customer.allRelatedOrders); Contexts.DB.Entry(customer).State = EntityState.Deleted; int num = Contexts.DB.SaveChanges(); } }
public static void DeletePastry(Pastery PastryToRemove) { //using (PastryContext Contexts.DB = new PastryContext()) { var pastry = GetPatry(PastryToRemove.ID); OrderdDAL.DeleteAllRelatedDetails(pastry.OrdersDetailes); Contexts.DB.Entry(pastry).State = EntityState.Deleted; int num = Contexts.DB.SaveChanges(); } }