public HttpResponseMessage Get() { HttpResponseMessage responseMessage; JSend json; string token = Request.Headers.SingleOrDefault(x => x.Key == "token").Value.First(); int[] pageVal = GetPageNumberAndElementNumber(); int page_nr = pageVal[0]; int per_page = pageVal[1]; string state = GetState(); List <FormDTO> list = formModel.GetAllForms(token, page_nr, per_page, state); if (list.Count > 0) { json = new JSendData <FormDTO>("success", list); responseMessage = Request.CreateResponse(HttpStatusCode.OK, json); } else { json = new JSendMessage("fail", "No items found"); responseMessage = Request.CreateResponse(HttpStatusCode.NotFound, json); } return(responseMessage); }
public IEnumerable <FormDTO> Get() { string token = Request.Headers.SingleOrDefault(x => x.Key == "token").Value.First(); List <FormDTO> list = new List <FormDTO>(); list = formModel.GetAllForms(token); return(list); }