public async Task <IActionResult> AddIngredient(Guid id, Ingredients newIngredient) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } if (newIngredient.Quantity <= 0 || newIngredient.Title == null) { return(RedirectToAction("Index")); } var successful = await recipeService.AddIngredientsAsync(id, newIngredient); if (!successful) { return(BadRequest("Could not add ingredient")); } return(RedirectToAction("Index")); }