Exemplo n.º 1
0
 public static Entities.Orders Map(PizzaBox_Lib.Models.Orders orders)
 {
     return(new Entities.Orders()
     {
         Id = orders.Id,
         Pizzas = orders.Pizzas,
         Total = orders.Total,
         Userid = orders.Userid,
         Storeid = orders.Storeid,
         TimeOrdered = orders.TimeOrdered,
         //Store = Map(orders.Store),
         //User = Map(orders.User)
     });
 }
Exemplo n.º 2
0
 public void UpdateOrder(PizzaBox_Lib.Models.Orders orders)
 {
     if (db.Orders.Any(o => o.Id == orders.Id))
     {
         var o = db.Orders.FirstOrDefault(o => o.Id == orders.Id);
         o.Pizzas = orders.Pizzas;
         o.Total  = orders.Total;
         db.Orders.Update(o);
         db.SaveChanges();
     }
     else
     {
         Console.WriteLine($"Order with the Id {orders.Id} does not exist");
         return;
     }
 }
Exemplo n.º 3
0
 public void AddOrder(PizzaBox_Lib.Models.Orders orders)
 {
     db.Orders.Add(Mapper.Map(orders));
     db.SaveChanges();
 }