Ejemplo n.º 1
0
        public async Task <IActionResult> GetUserDetails(int userId)
        {
            object response = new object();

            try
            {
                if (await _factory.BuildUsersResponse() == null)
                {
                    response = new UserDetailErrorResponse {
                        ErrorMessage = "There was an error processing the request."
                    };
                    return(BadRequest(response));
                }
                response = await _factory.BuildUserDetail(userId);
            }
            catch (Exception ex) {
                _logger.LogError("{0} The following error exception was thrown by the system when attempting to obtain user details for user {1}:  ", ex.Message, userId);
            }
            var jsonResponse = JsonSerializer.Serialize(response);

            //only for tests with Postman
            return(Ok(response));
        }