public async Task <IActionResult> UpdateValue([FromRoute] Guid id, [FromBody] RequestUpdateValueDto updateValue) { try { var updateValueResult = await _valueService.UpdateAsync(id, updateValue); if (updateValueResult == null) { return(NotFound()); } return(NoContent()); } catch (Exception ex) { return(ValidationProblem(ex.Message)); } }
/// <inheritdoc /> public async Task <ResponseValueDto> UpdateAsync(Guid valueId, RequestUpdateValueDto updateValueDto) { Guard.Argument(() => updateValueDto).NotNull(); if (valueId == Guid.Empty) { return(null); } var existingValue = await _valueRepository.GetByIdAsync(valueId); if (existingValue == null) { return(null); } _mapper.Map <RequestUpdateValueDto, Entities.Value>(updateValueDto, existingValue); await _valueRepository.UpdateAsync(existingValue, false, updateValueDto.RowVersion); return(_mapper.Map <Entities.Value, ResponseValueDto>(existingValue)); }