public ActionResult <ReactionReadDto> Update(int id, [FromBody] ReactionUpdateDto request) { if (_reactionTypeRepository.Get(request.ReactionTypeId) == null) { return(StatusCode(StatusCodes.Status400BadRequest, "Reaction type doesn't exist.")); } Reaction found = _reactionRepository.Get(id); if (found == null) { return(StatusCode(StatusCodes.Status400BadRequest, "Reaction doesn't exist.")); } found = _mapper.Map(request, found); _reactionRepository.Update(found); return(StatusCode(StatusCodes.Status200OK, _mapper.Map <ReactionReadDto>(found))); }