public IActionResult Edit(StageViewModel viewModel) { if (!ModelState.IsValid) { return(BadRequest()); } try { var stage = _Mapper.Map <Stage>(viewModel); _StageBL.Edit(GetUserId(), stage); var retVal = _Mapper.Map <StageViewModel>(stage); return(Ok(retVal)); } catch (BusinessException ex) { return(BadRequest((ErrorCodes)ex.ErrorCode)); } catch (Exception ex) { _Logger.LogError(ex, $"Error in {typeof(StagesController)}: {ex.Message}"); return(StatusCode(500)); } }
public IActionResult Edit(PointViewModel viewModel) { if (!ModelState.IsValid) { return(BadRequest()); } try { var pointModel = _Mapper.Map <Point>(viewModel); _PointBL.Edit(GetUserId(), pointModel); return(Ok(_Mapper.Map <PointViewModel>(pointModel))); } catch (BusinessException ex) { return(BadRequest((ErrorCodes)ex.ErrorCode)); } catch (Exception ex) { _Logger.LogError(ex, $"Error in {typeof(PointsController)}: {ex.Message}"); return(StatusCode(500)); } }
public IActionResult Edit(TeamViewModel viewModel) { if (!ModelState.IsValid) { return(BadRequest()); } try { var team = _mapper.Map <Team>(viewModel); _teamBL.Edit(GetUserId(), team); viewModel = _mapper.Map <TeamViewModel>(team); viewModel.AddQrCode(viewModel.RaceId); return(Ok(viewModel)); } catch (BusinessException ex) { return(BadRequest((ErrorCodes)ex.ErrorCode)); } catch (Exception ex) { _logger.LogError(ex, $"Error in {typeof(TeamsController)}: {ex.Message}"); return(StatusCode(500)); } }