public IQueryable <HelpRequest> GetAll(HelpRequestCategory helpRequestCategory)
 {
     return(_context.HelpRequests
            .AsNoTracking()
            .Include(hp => hp.Client)
            .Where(hp => (helpRequestCategory == 0 || hp.HelpRequestCategory == helpRequestCategory)));
 }
示例#2
0
        public IHttpActionResult Get(HelpRequestCategory helpRequestCategory = 0, int page = 1, int pageSize = 15)
        {
            var query = _helpRequestService.GetAll(helpRequestCategory);

            PagingResultVM <HelpRequestsModel> pagingResult =
                _pagingResultFactory.CreatePagingResultDesc(query, pageSize, page, x => x.RequestDate, GetHelpRequestViewModelSelector());

            return(Ok(pagingResult));
        }
        public async Task <ActionResult> Data(HelpRequestCategory helpRequestCategory = 0, int page = 1)
        {
            var response = await _httpClientService
                           .GetJsonContent(_commonService.GenerateQueryStringUrl(
                                               "api/helprequests/all",
                                               Parameters.Pair("helpRequestCategory", helpRequestCategory),
                                               Parameters.Pair("page", page),
                                               Parameters.Pair("pageSize", AssistanceConstants.PageSize)));

            var model = new HelpRequestsManageModel
            {
                PagingResult        = await response.Content.ReadAsAsync <PagerModel <HelpRequestsModel> >(),
                HelpRequestCategory = helpRequestCategory
            };

            return(PartialView("_Data", model: model));
        }