public IEnumerable <ClientPayedBillsSum> Ask(GetPayedBillsSumCriterion criterion) { List <ClientPayedBillsSum> clientPayedBillsSums = _statService .GetPayedBillsSum (criterion.Count, criterion.StartDateTime, criterion.EndDateTime); return(clientPayedBillsSums); }
[HttpGet]//get public HttpResponseMessage PayedBillsSum(JObject jsonData) { HttpResponseMessage response; string s = jsonData.ToString().Replace(" ", ""); GetPayedBillsSumCriterion criterion = jsonData .ToObject <GetPayedBillsSumCriterion>(); if (criterion.StartDateTime == null) { criterion.StartDateTime = ""; } else { criterion.StartDateTime = s.Substring(s.IndexOf("StartDateTime") + "StartDateTime".Length + 3, 19); } if (criterion.EndDateTime == null) { criterion.EndDateTime = ""; } else { criterion.EndDateTime = s.Substring(s.IndexOf("EndDateTime") + "EndDateTime".Length + 3, 19); } try { IEnumerable <ClientPayedBillsSum> clientBillsSums = queryBuilder .For <IEnumerable <ClientPayedBillsSum> >() .With(criterion); if (!clientBillsSums.Any()) { response = Request.CreateResponse(HttpStatusCode.BadRequest); } else { response = Request.CreateResponse(HttpStatusCode.OK, clientBillsSums); } } catch (Exception ex) { ErrorObject err = new ErrorObject(ex.Message); return(Request.CreateResponse(HttpStatusCode.InternalServerError, err)); } return(response); }