Exemplo n.º 1
0
        //[Produces("application/json")]
        public async Task <IActionResult> GetUsers()
        {
            object response = new object();

            try
            {
                if (await _factory.BuildUsersResponse() == null)
                {
                    response = new UserDetailErrorResponse {
                        ErrorMessage = "No users could be be found"
                    };
                    return(BadRequest(response));
                }
                response = await _factory.BuildUsersResponse();
            }
            catch (Exception ex) {
                _logger.LogError("{0} The following error exception was thrown by the syste:  ", ex.Message);
            }
            var jsonResponse = JsonSerializer.Serialize(response);

            return(Ok(jsonResponse));
        }