Exemplo n.º 1
0
 public IActionResult AddIngredientToProduct(int productId)
 {
     try
     {
         var model = _repository.GetProduct(productId);
         ViewBag.Ingredients = _repository.GetAllIngredients().Select(x => new SelectListItem {
             Text = x.Name, Value = x.Id.ToString()
         }).ToList();
         return(View(model));
     }
     catch (Exception ex)
     {
         return(View("Error", ex));
     }
 }