public void UpdateIngredientSupplier(IngredientSupplier ingredientSupplier) { var ingredientSupplierUpdate = _databaseContext.IngredientSuppliers.FirstOrDefault(i => i.Id == ingredientSupplier.Id); if (ingredientSupplierUpdate != null) { ingredientSupplierUpdate.TotalAmount = ingredientSupplier.TotalAmount; ingredientSupplierUpdate.Price = ingredientSupplier.Price; ingredientSupplierUpdate.IngredientId = ingredientSupplier.IngredientId; _databaseContext.IngredientSuppliers.Update(ingredientSupplierUpdate); } _databaseContext.SaveChanges(); }
public ActionResult AddSupplierIngredient(int supplierId, [FromBody] IngredientSupplierViewModel ingredientSupplierViewModel) { if (ingredientSupplierViewModel == null) { return(BadRequest("IngredientSupplier cannot be null.")); } var ingredientSupplier = new IngredientSupplier() { IngredientId = ingredientSupplierViewModel.IngredientId, Price = ingredientSupplierViewModel.Price, SupplierId = ingredientSupplierViewModel.SupplierId, TotalAmount = ingredientSupplierViewModel.TotalAmount }; _ingredientSupplierService.AddIngredientSupplier(ingredientSupplier); return(StatusCode(201)); }
public void AddIngredientSupplier(IngredientSupplier ingredientSupplier) { _databaseContext.IngredientSuppliers.Add(ingredientSupplier); _databaseContext.SaveChanges(); }
public void UpdateIngredientSupplier(IngredientSupplier ingredientSupplier) { _ingredientSupplierRepository.UpdateIngredientSupplier(ingredientSupplier); }
public void AddIngredientSupplier(IngredientSupplier ingredientSupplier) { _ingredientSupplierRepository.AddIngredientSupplier(ingredientSupplier); }