Ejemplo n.º 1
0
 public static List <Food> ListFood()
 {
     using (ShopOrders entities = new ShopOrders())
     {
         return(entities.Foods.ToList <Food>());
     }
 }
Ejemplo n.º 2
0
 public static List <Size> ListSize()
 {
     using (ShopOrders entities = new ShopOrders())
     {
         return(entities.Sizes.ToList <Size>());
     }
 }
Ejemplo n.º 3
0
 public static List <Order> ListOrdersBy(string name)
 {
     using (ShopOrders entities = new ShopOrders())
     {
         return(entities.Orders.Where(p => p.Username == name).ToList <Order>());
     }
 }
Ejemplo n.º 4
0
 public static string GetFood(int id)
 {
     using (ShopOrders entities = new ShopOrders())
     {
         Food f = entities.Foods.Where(p => p.ID == id).First <Food>();
         return(f.Name);
     }
 }
Ejemplo n.º 5
0
 public static void DeleteOrder(int orderId)
 {
     using (ShopOrders entities = new ShopOrders())
     {
         Order order = entities.Orders.Where(p => p.OrderID == orderId).First <Order>();
         entities.Orders.Remove(order);
         entities.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 public static void UpdateOrder(int orderId,
                                string size, string chilli, string salt, string pepper)
 {
     using (ShopOrders entities = new ShopOrders())
     {
         Order order = entities.Orders.Where(p => p.OrderID == orderId).First <Order>();
         order.Size     = size;
         order.Chilli   = chilli;
         order.MoreSalt = salt;
         order.Pepper   = pepper;
         entities.SaveChanges();
     }
 }
Ejemplo n.º 7
0
 public static void AddOrder(string user, int foodID, string foodname, string size, string chilli, string salt, string pepper)
 {
     using (ShopOrders entities = new ShopOrders())
     {
         Order order = new Order
         {
             Username = user,
             Size     = size,
             FoodID   = foodID,
             Chilli   = chilli,
             MoreSalt = salt,
             Pepper   = pepper
         };
         entities.Orders.Add(order);
         entities.SaveChanges();
     }
 }