コード例 #1
0
        public int CreateRestaurant(Restaurant restaurant)
        {
            var result = _restaurantRepo.CreateRestaurant(restaurant);

            if (result)
            {
                return(_restaurantRepo.GetLatestRestaurantId());
            }
            return(0);
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: Mc-Markus/WebAppHF
 public ActionResult CreateRestaurant(Restaurant restaurant)
 {
     try
     {
         if (ModelState.IsValid)
         {
             restaurantRepo.CreateRestaurant(restaurant);
             return(RedirectToAction("RestaurantList"));
         }
     }
     catch (DataException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(restaurant));
 }