예제 #1
0
 public IActionResult AddDish(Dish dish)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _repository.AddDish(dish);
             ViewBag.Product = _repository.GetProductsSelectList();
             return(Json(new { status = "ok", mealId = dish.MealId })); //PartialView("_AddDish", new Dish());
         }
         else
         {
             ViewBag.Product = _repository.GetProductsSelectList();
             return(PartialView("_AddDish", dish));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", ex));
     }
 }