コード例 #1
0
 public ActionResult CreateTour(TourViewModel newTour)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var tourDto = Mapper.Map <TourDTO>(newTour);
             managementService.AddTour(tourDto);
             TempData["successful"] = string.Format("Новый тур \"{0}\" был добавлен", newTour.Name);
             return(RedirectToAction("Index", "Manager"));
         }
     }
     catch (ValidationException ex)
     {
         ModelState.AddModelError(ex.Property, ex.Message);
     }
     return(View(newTour));
 }