public IActionResult Edit(JourneyViewModel model) { if (ModelState.IsValid) { model = _journeyService.UpdateJourney(model); return(RedirectToAction(nameof(Index))); } return(View(model)); }
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 })); } }
public void Put([FromBody] Journey journey) { _journeyService.UpdateJourney(journey); }