Exemple #1
0
        public HttpResponseMessage CardData()
        {
            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.CardData(config.usuario.usuario_Id);
                    data.result = new { service.outstandingcomplaints, service.outstandingdenounces, service.attendedcomplaints, service.attendeddenounces };
                    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, "Card data");
            }
            finally
            {
                response.Content = CreateContent(data);
            }

            return(response);
        }