コード例 #1
0
        public IActionResult Edit(JourneyViewModel model)
        {
            if (ModelState.IsValid)
            {
                model = _journeyService.UpdateJourney(model);

                return(RedirectToAction(nameof(Index)));
            }

            return(View(model));
        }
コード例 #2
0
 public IActionResult Update(JourneyModel model)
 {
     try
     {
         var config = new MapperConfiguration(cfg =>
         {
             cfg.CreateMap <JourneyModel, Journey>();
         });
         IMapper iMapper = config.CreateMapper();
         var     journey = iMapper.Map <JourneyModel, Journey>(model);
         var     result  = _journeyService.UpdateJourney(journey);
         return(Ok(result));
     }
     catch (Exception ex)
     {
         ex.LogException();
         return(Ok(new ServiceResponse {
             Status = DAL.Common.Enums.ResponseStatus.ServerError
         }));
     }
 }
コード例 #3
0
 public void Put([FromBody] Journey journey)
 {
     _journeyService.UpdateJourney(journey);
 }