//MAPPING INVENTORY //Entity-->Data object public static Library.Inventory MapEFWithInventory(Entities.Inventory EInventory) { return(new Library.Inventory { Quantity = EInventory.Quantity, LID = EInventory.Lid, PID = EInventory.Pid }); }
public void DecrementInventory(string product, int storeId) { _logger.LogInformation("Decrementing Inventory with Product {product}, from store with Id {storeId}", product, storeId); Entities.Inventory entity = _dbContext.Inventory .Where(p => p.Product == product && p.StoreId == storeId) .SingleOrDefault(); entity.Quantity -= 1; }
public void AddToOrder(int orderId, int prodId) { Entities.CurrentOrder order = _dbContext.CurrentOrder .First(); Entities.Inventory product = _dbContext.Inventory .Where(p => p.Id == prodId).SingleOrDefault(); order.Order += product.Product + " + "; order.TotalPrice += product.Price; _dbContext.SaveChanges(); return; }