Ejemplo n.º 1
0
 public void Update(Domain.Models.Order existing, Domain.Models.Order updated)
 {
     Entities.Order dbOrder = mapper.Map(existing, context);
     Entities.Order order   = context.Orders.ToList().Find(o => o.GetHashCode() == dbOrder.GetHashCode());
     if (order is not null)
     {
         Entities.Order updatedOrder = mapper.Map(updated, context);
         order.Customer   = updatedOrder.Customer;
         order.Pizzas     = updatedOrder.Pizzas;
         order.Store      = updatedOrder.Store;
         order.TimePlaced = updatedOrder.TimePlaced;
         order.TotalPrice = updatedOrder.TotalPrice;
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void Remove(Domain.Models.Order t)
 {
     Entities.Order dbOrder = mapper.Map(t, context);
     Entities.Order order   = context.Orders.ToList().Find(o => o.GetHashCode() == dbOrder.GetHashCode());
     if (order is not null)
     {
         context.Remove(order);
         context.SaveChanges();
     }
 }