public JsonResult InsertIngredient(IngredientDto ingredient) { if (!string.IsNullOrEmpty(ingredient.Name)) { int recipeID = Convert.ToInt32(Session["RecipeID"]); ingredient.RecipeId = recipeID; ingredient.Id = _ingredientRepository.AddNewIngredient(ingredient); return(Json(ingredient)); } return(null); }