Exemplo n.º 1
0
        public async Task OnGetAsync(string pageNo, string districtName, bool deleted, string dateFrom, string dateTo, string creatorId, string status)
        {
            SearchInput = new DistrictSearchViewModel
            {
                PageNo = pageNo.FixPageNumber(),
                Name   = districtName,
                IncludeDeletedItems = deleted,
                CreatorId           = creatorId,
                CreationDateFrom    = dateFrom,
                CreationDateTo      = dateTo
            };

            Status = !string.IsNullOrEmpty(status)
                ? status
                : null;
            List = await _locationService.DistrictListAsync(SearchInput, false);
        }
Exemplo n.º 2
0
        public async Task <PaginationViewModel <DistrictViewModel> > DistrictListAsync(DistrictSearchViewModel searchModel, bool loadData = true)
        {
            var query = _baseService.CheckDeletedItemsPrevillege(_districts, searchModel, out var currentUser);

            if (query == null)
            {
                return(new PaginationViewModel <DistrictViewModel>());
            }

            if (searchModel != null)
            {
                if (!string.IsNullOrEmpty(searchModel.Name))
                {
                    query = query.Where(x => EF.Functions.Like(x.Name, searchModel.Name.Like()));
                }

                query = _baseService.AdminSeachConditions(query, searchModel);
            }

            var result = await _baseService.PaginateAsync(query, searchModel,
                                                          item => item.Map <DistrictViewModel>(), loadData : loadData);

            return(result);
        }