public HttpResponseMessage AllComplains(string state, string from, string to) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); ResponseConfig config = VerifyAuthorization(Request.Headers); RestResponse data = new RestResponse(); try { VerifyMessage(config.errorMessage); if (from == "_ALL_") { from = ""; } if (to == "_ALL_") { to = ""; } if (state == "-1") { state = ""; } using (ComplainService service = new ComplainService()) { var complains = service.AllComplains(state, to, from); data.result = new { complains, service.attendedcomplaints, service.newcomplaints, service.complaintsinprocess }; 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 Quejas"); } finally { response.Content = CreateContent(data); } return(response); }