public static void DeleteOrder(tblOrder order)
 {
     try
     {
         using (dbPizzeria1Entities context = new dbPizzeria1Entities())
         {
             tblOrder orderToDelete = (from u in context.tblOrders where u.orderId == order.orderId select u).First();
             context.tblOrders.Remove(orderToDelete);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
     }
 }
 public static tblOrder AddNewOrder(tblOrder order)
 {
     try
     {
         using (dbPizzeria1Entities context = new dbPizzeria1Entities())
         {
             if (order.orderId == 0)
             {
                 //add
                 tblOrder newOrder = new tblOrder();
                 newOrder.status      = order.status;
                 newOrder.username    = order.username;
                 newOrder.dateAndTime = order.dateAndTime;
                 newOrder.dishId      = order.dishId;
                 newOrder.count       = order.count;
                 context.tblOrders.Add(newOrder);
                 context.SaveChanges();
                 order.orderId = newOrder.orderId;
                 return(order);
             }
             else
             {
                 //edit
                 tblOrder orderToEdit = (from x in context.tblOrders where x.orderId == order.orderId select x).FirstOrDefault();
                 orderToEdit.status = order.status;
                 context.SaveChanges();
                 return(order);
             }
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception: " + ex.Message.ToString());
         return(null);
     }
 }