public void UpdateItem(Item item2BUpdated)
 {
     Entity.Item oldItem = _context.Items.Find(item2BUpdated.ItemID);
     _context.Entry(oldItem).CurrentValues.SetValues(_mapper.ParseItem(item2BUpdated));
     _context.SaveChanges();
     _context.ChangeTracker.Clear();
 }
示例#2
0
        public void changeInventory(Model.Location location, Model.Item item, int amount)
        {
            Entity.Item Eitem = _context.Items.
                                FirstOrDefault(itm => itm.OrderId == null && itm.LocationId == location.LocationID && itm.ProductName == item.Product.ProductName);

            Eitem.Quantity += amount;

            _context.SaveChanges();
        }
示例#3
0
 public Model.Item ParseItem(Entity.Item item)
 {
     Model.Item newItem = new Model.Item(item.Quantity, ParseProduct(item.Product), ParseLocation(item.Location));
     newItem.ItemID = item.ItemId;
     return(newItem);
 }