コード例 #1
0
        [HttpGet]//get
        public HttpResponseMessage List(JObject jsonData)
        {
            HttpResponseMessage response;
            GetBillsCriterion   criterion = jsonData.ToObject <GetBillsCriterion>();

            try
            {
                IEnumerable <Bill> bills =
                    queryBuilder
                    .For <IEnumerable <Bill> >()
                    .With(criterion);
                if (!bills.Any())
                {
                    response = Request.CreateResponse(HttpStatusCode.BadRequest);
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, bills);
                }
            }
            catch (Exception ex)
            {
                ErrorObject err = new ErrorObject(ex.Message);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, err));
            }
            return(response);
        }
コード例 #2
0
        public IEnumerable <Domain.Entities.Bill> Ask(GetBillsCriterion criterion)
        {
            List <Domain.Entities.Bill> bills = _billService.GetBills(criterion.Offset, criterion.Count);

            return(bills);
        }