Пример #1
0
        public async Task <IActionResult> GetListEverything()
        {
            try
            {
                IQueryCollection queryParams = Request.Query;

                if (!AppUtils.IsValidParameters(queryParams, everythingValidParams))
                {
                    return(BadRequest(new Error()
                    {
                        Message = $"A consulta contém parâmetros inválidos. Parâmetros válidos: {string.Join(", ", everythingValidParams)}", Status = "error"
                    }));
                }

                List <KeyValuePair <string, object> > parameters = AppUtils.GetParameters(queryParams, everythingValidParams);

                var result = await _services.GetListEverything(parameters);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(new Error()
                {
                    Message = $"Erro ao retornar os dados. {ex.Message}", Status = "error"
                }));
            }
        }