public async Task <ActionResult <UserModel> > UpdateUser([FromBody] UpdateUserDto updatingDto) { try { var updatingModel = _mapper.Map <UpdateUserDto, UserModel>(updatingDto); return(await _userService.UpdateUserAsync(updatingModel)); } catch (VersionsNotMatchException vnme) { return(Conflict(vnme.Message)); } catch (Exception e) { return(NotFound(e.Message)); } }
public async Task <ActionResult <UserModel> > UpdateUser([FromBody] UpdateUserDto updatingDto) { try { string currentUserId = Request.Headers[Constants.UserIdHeaderName]; if (currentUserId != updatingDto.Id) { return(StatusCode((int)HttpStatusCode.Forbidden)); } var updatingModel = _mapper.Map <UpdateUserDto, UserModel>(updatingDto); return(await _userService.UpdateUserAsync(updatingModel)); } catch (VersionsNotMatchException vnme) { return(Conflict(vnme.Message)); } catch (Exception e) { return(NotFound(e.Message)); } }