コード例 #1
0
 public Model.Stock AddStock(Model.LineItem item, Model.Location location, int quantity)
 {
     Entity.Stock oldStock = _context.Stocks.FirstOrDefault(stock => stock.Product == GetColor(item.Product).Id&& stock.Location == location.Id);
     oldStock.Quantity = oldStock.Quantity + quantity;
     _context.SaveChanges();
     //_context.ChangeTracker.Clear();
     return(new Model.Stock(item.Product, location, oldStock.Quantity));
 }
コード例 #2
0
 public Model.LineItem AddLineItem(Model.LineItem item)
 {
     _context.LineItems.Add(
         new Entity.LineItem
     {
         Orderid  = GetOrder(item.Order).Id,
         Product  = GetColor(item.Product).Id,
         Quantity = item.Quantity
     }
         );
     _context.SaveChanges();
     return(item);
 }