public void UpdateInventory(Inventory inv) { Entity.Inventory oldInv = _context.Inventories.Find(inv.ID); _context.Entry(oldInv).CurrentValues.SetValues(_mapper.ParseInventory(inv)); _context.SaveChanges(); _context.ChangeTracker.Clear(); }
public Model.Inventory ParseInventory(Entity.Inventory inv) { return(new Model.Inventory { ID = inv.Id, Quantity = inv.Quantity, LocationID = (int)inv.LocationId, ProductID = (int)inv.ProductId }); }