Exemple #1
0
        public IActionResult UpdateUserDetails(int id, [FromBody] UserDetailsUpdateModel updateModel)
        {
            updateModel.UserId = id;

            UpdateUserDetailsResponse response = _userService.UpdateUserDetails(updateModel);

            if (!response.ResponseStatus.HasError())
            {
                return(Ok());
            }

            return(StatusCode(response.ResponseStatus.Status, response.ResponseStatus.Message));
        }
Exemple #2
0
        public UpdateUserDetailsResponse UpdateUserDetails(UserDetailsUpdateModel updateModel)
        {
            UpdateUserDetailsResponse response = new UpdateUserDetailsResponse();

            //TODO: Handle with non existent user id

            try
            {
                _userRepository.UpdateUserDetails(updateModel);

                response.ResponseStatus.SetOk();
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());

                response.ResponseStatus.SetError(ResponseStatusCode.INTERNAL_SERVER_ERROR,
                                                 e.ToString());
            }

            return(response);
        }