Ejemplo n.º 1
0
 public ActionResult CreateTrain(TrainViewModel train)
 {
     try
     {
         var trainDto = new TrainDTO {
             Name = train.Name, Description = train.Description
         };
         _trainService.MakeTrain(trainDto);
         return(Content("Вы успешно создали поезд"));
     }
     catch (ValidationException ex)
     {
         ModelState.AddModelError(ex.Property, ex.Message);
     }
     return(View(train));
 }