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(); }
public Entity.Item ParseItem(Model.Item item) { return(new Entity.Item { Quantity = item.Quantity, ProductId = item.Product.ProductID, LocationId = item.Location.LocationID, ItemId = item.ItemID }); }
public Model.Item AddItemToLocation(Model.Location location, Model.Item item) { _context.Items.Add( new Entity.Item { LocationId = location.LocationID, OrderId = null, ProductName = item.Product.ProductName, Price = item.Product.Price, Quantity = item.Quantity } ); _context.SaveChanges(); return(item); }
//set orderITem public Entity.OrderItem ParseIt(Model.Item Item) { if (Item.Id == null) { return(new Entity.OrderItem { Product = Item.PFK, Quantity = Item.Quantity, StoreOrder = Item.OID }); } return(new Entity.OrderItem { Product = Item.PFK, Quantity = Item.Quantity, StoreOrder = Item.OID }); }
public Models.Order ParseOrder(Entities.StoreOrder order) { Models.Order o = new Models.Order(); o.OrderID = order.OrderId; o.Customer = ParseCustomer(order.Customer); o.Location = ParseLocation(order.Location); o.CheckedOut = order.CheckedOut != null; if (o.CheckedOut) { o.CheckoutTimestamp = (DateTime)order.CheckedOut; } List <Models.Item> items = new List <Models.Item>(); foreach (Entities.OrderItem item in order.OrderItems) { Models.Item i = new Models.Item(); i.Product = ParseProduct(item.Product); i.Quantity = item.Quantity; items.Add(i); } o.Items = items; return(o); }
public Model.Item AddIO(Model.Item I) { _context.OrderItems.Add(_mapper.ParseIt(I)); _context.SaveChanges(); return(I); }
public Model.Item AddItem(Model.Item newItem) { _context.Items.Add(_mapper.ParseItem(newItem)); _context.SaveChanges(); return(newItem); }
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); }
public Entities.OrderItem ParseItem(Models.Item item) { return(new Entities.OrderItem()); }