コード例 #1
0
        public async Task <PaginationViewModel <DivisionViewModel> > ListAsync(DivisionSearchViewModel searchModel)
        {
            var query = _baseService.CheckDeletedItemsPrevillege(_divisions, searchModel, out var currentUser);

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

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

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

                query = _baseService.AdminSeachConditions(query, searchModel);
            }
            var result = await _baseService.PaginateAsync(query, searchModel,
                                                          item => item.Map <DivisionViewModel>());

            return(result);
        }
コード例 #2
0
        public async Task OnGetAsync(string pageNo, string divisionName, string id, bool deleted, string dateFrom, string dateTo, string creatorId, string status)
        {
            SearchInput = new DivisionSearchViewModel
            {
                PageNo = pageNo.FixPageNumber(),
                Name   = divisionName,
                Id     = id,
                IncludeDeletedItems = deleted,
                CreatorId           = creatorId,
                CreationDateFrom    = dateFrom,
                CreationDateTo      = dateTo
            };

            Status = !string.IsNullOrEmpty(status)
                ? status
                : null;
            List = await _divisionService.ListAsync(SearchInput);
        }