示例#1
0
        public HttpResponseMessage DeleletComplain(int news_id)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            ResponseConfig      config   = VerifyAuthorization(Request.Headers);
            RestResponse        data     = new RestResponse();

            try
            {
                VerifyMessage(config.errorMessage);

                using (NewService service = new NewService())
                {
                    service.Delete(news_id);
                    data.result  = null;
                    data.status  = true;
                    data.message = "Se ha eliminado la noticia";
                }
            }
            catch (Exception ex)
            {
                response.StatusCode = config.isAuthenticated ? HttpStatusCode.BadRequest : HttpStatusCode.Unauthorized;
                data.status         = false;
                data.message        = ex.Message;
                data.error          = NewError(ex, "Eliminar queja");
            }
            finally
            {
                response.Content = CreateContent(data);
            }

            return(response);
        }