示例#1
0
 internal void AddNewOrderedMeal(tblMealOrder mealOrder)
 {
     using (var conn = new PizzaRestaurantEntities())
     {
         conn.tblMealOrders.Add(mealOrder);
         conn.SaveChanges();
     }
 }
示例#2
0
 internal void DeleteOrderedMeal(tblMealOrder mealOrder)
 {
     using (var context = new PizzaRestaurantEntities())
     {
         var orderToRemove = context.tblMealOrders.FirstOrDefault(e => e.MealOrderID == mealOrder.MealOrderID);
         if (orderToRemove != null)
         {
             context.tblMealOrders.Remove(orderToRemove);
             context.SaveChanges();
         }
     }
 }