public async Task <IActionResult> AddIngredient(Ingredient data) { try { if (ModelState.IsValid) { await _repository.AddIngredient(data); return(RedirectToAction("Ingredients")); } return(View(data)); } catch (Exception ex) { return(View("Error", ex)); } }