Example #1
0
 public static void AddOrder(FoodOrder order)
 {
     using (FoodStallEntities context = new FoodStallEntities())
     {
         context.FoodOrders.Add(order);
         context.SaveChanges();
     }
 }
Example #2
0
 public static void DeleteOrder(int orderID)
 {
     using (FoodStallEntities context = new FoodStallEntities())
     {
         FoodOrder order = context.FoodOrders.Where(y => y.OrderID == orderID).First();
         context.FoodOrders.Remove(order);
         context.SaveChanges();
     }
 }
Example #3
0
    public static void UpdateOrder(int order_toUpdate, string name, string dish, string size, bool chilli, bool salt, bool pepper)
    {
        FoodStallEntities context = new FoodStallEntities();
        FoodOrder         order   = context.FoodOrders.Where(y => y.OrderID == order_toUpdate).First();

        order.CustomerName = name;
        order.Dish         = dish;
        order.Size         = size;
        order.Chilli       = chilli;
        order.Salt         = salt;
        order.Pepper       = pepper;


        context.SaveChanges();
    }