Esempio n. 1
0
        public ActionResult Create(VesselScheduleViewModel viewModel)
        {
            var req = viewModel.MapTo <SaveVesselScheduleRequest>();

            _vesselScheduleService.SaveVesselSchedule(req);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Create(VesselScheduleViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var req  = viewModel.MapTo <SaveVesselScheduleRequest>();
         var resp = _vesselScheduleService.SaveVesselSchedule(req);
         return(Json(resp));
     }
     else
     {
         var errorList = (from item in ModelState
                          where item.Value.Errors.Any()
                          select item.Value.Errors[0].ErrorMessage).ToList();
         return(Json(new { IsSuccess = false, Message = errorList }));
     }
 }