public SuccessResponse Update(WarningRequest request) { try { var currentWarning = _warningRepository.FindBy(request.Id); currentWarning.ThrowExceptionIfRecordIsNull(); var warningToCopy = TypeAdapter.Adapt <Warning>(request); TypeAdapter.Adapt(warningToCopy, currentWarning); _warningValidator.ValidateAndThrowException(currentWarning, "Base,Update"); _warningRepository.Update(currentWarning); return(new SuccessResponse { IsSuccess = true }); } catch (DataAccessException) { throw new ApplicationException(); } }
public async Task Update(Warning warning) { await _warningRepository.Update(warning); }
public IActionResult Put(int id, [FromBody] Warning value) { warningRepository.Update(value); return(Ok()); }