public HttpResponseMessage Post([FromBody] InventoryItem inventoryItem) { if (_repo.AddInventoryItem(inventoryItem) && _repo.Save()) { return(Request.CreateResponse(HttpStatusCode.Created, inventoryItem)); } return(Request.CreateResponse(HttpStatusCode.BadRequest)); }
public Task <bool> AddInventory(Inventory inventory) { bool isprodAdded = _inventoryRepository.AddInventoryItem(inventory); if (isprodAdded) { return(Task.FromResult(isprodAdded)); } return(Task.FromResult <bool>(false)); }
public void AddIngredientToFridge(InventoryItem inventoryItem) { var existingInventoryItem = _inventoryRepository.Get(inventoryItem.Name); if (existingInventoryItem == null) { _inventoryRepository.AddInventoryItem(inventoryItem); return; } inventoryItem.Quantity += inventoryItem.Quantity; _inventoryRepository.UpdateInventoryItem(inventoryItem); }