Exemple #1
0
 public Model.Orders GetOrders(Model.Orders orders)
 {
     Entity.Order found = _context.Orders.FirstOrDefault(ord => ord.OrderId == orders.OrderId);
     if (found == null)
     {
         return(null);
     }
     return(new Model.Orders(found.OrderId, found.OrderQuantity, found.OrderNumber, found.OrderTotal, found.OrderLocation));
 }
Exemple #2
0
        public void UpdateOrder(Model.Orders order2BeUpdated)
        {
            Entity.Order oldOrder = _context.Orders.Find(order2BeUpdated.OrderId);

            _context.Entry(oldOrder).CurrentValues.SetValues(order2BeUpdated);


            Entity.Order oldOrder1 = _context.Orders.Find(order2BeUpdated.OrderId);


            oldOrder1.OrderQuantity = order2BeUpdated.OrderQuantity;

            oldOrder1.OrderTotal = order2BeUpdated.OrderTotal;

            _context.Entry(oldOrder).CurrentValues.SetValues((order2BeUpdated));


            _context.SaveChanges();

            // _context.ChangeTracker.Clear();
        }