Esempio n. 1
0
        public HttpResponseMessage getNewsFilter(string expired, string filter)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            ResponseConfig      config   = VerifyAuthorization(Request.Headers);
            RestResponse        data     = new RestResponse();

            try
            {
                VerifyMessage(config.errorMessage);

                if (expired == "_ALL_")
                {
                    expired = "";
                }

                if (filter == "_ALL_")
                {
                    filter = "";
                }


                using (NewService service = new NewService())
                {
                    var Noticias = service.GETNEWSFILTER(expired, filter);
                    data.result = new { Noticias };
                    data.status = true;
                }
            }
            catch (Exception ex)
            {
                response.StatusCode = config.isAuthenticated ? HttpStatusCode.BadRequest : HttpStatusCode.Unauthorized;
                data.status         = false;
                data.message        = ex.Message;
                data.error          = NewError(ex, "Lista de Noticias");
            }
            finally
            {
                response.Content = CreateContent(data);
            }

            return(response);
        }