Пример #1
0
 public ActionResult Delete(int id, RestaurantBusiness.Restaurant rest)
 {
     try
     {
         // TODO: Add delete logic here
         rutility.DeleteRestaurant(id);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         log = LogManager.GetLogger("errors");
         log.Error($"[Restaurants Controller] [Details] Exception thrown: {e.Message}");
         return(View());
     }
 }
Пример #2
0
 public ActionResult Edit(int id, RestaurantBusiness.Restaurant rest)
 {
     try
     {
         // TODO: Add update logic here
         if (ModelState.IsValid)
         {
             //business logic
             rutility.EditRestaurant(rest, id);
             return(RedirectToAction("Details", new { id = id }));
         }
         else
         {
             log = LogManager.GetLogger("errors");
             return(View(rutility));
         }
     }
     catch (Exception)
     {
         return(View());
     }
 }
Пример #3
0
 public ActionResult Create(RestaurantBusiness.Restaurant rest)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             //business logic
             rutility.AddRestaurant(rest);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(rutility));
         }
     }
     catch
     {
         log = LogManager.GetLogger("errors");
         return(View());
     }
 }