Пример #1
0
        public IActionResult Index(ResourceSearchModel searchModel)
        {
            //var schoolContext = _context.Resources.Include(d => d.Culture);
            //return View(schoolContext);


            var business = new ResourceBusinessLogic(_context, _repoCulture, _repoResource);
            var model    = business.GetResources(searchModel);

            return(View(model));
        }
        public ActionResult List()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageResource))
            {
                return(AccessDeniedView());
            }
            var model = new ResourceSearchModel();

            model.ResourceTypes = ResourceTypeModel.Instructions.ToSelectList(false).ToList();
            model.ResourceTypes.Insert(0, new SelectListItem {
                Text = "--加载所有--", Value = "0"
            });
            return(View(model));
        }
        public ActionResult List(DataSourceRequest command, ResourceSearchModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageResource))
            {
                return(AccessDeniedView());
            }
            var query = _resourcesService.GetAllPagedList(model.SearchName, model.SearchStartDate,
                                                          model.SearchEndDate, command.Page - 1, command.PageSize);
            var modelList = new List <ResourceListModel>();

            PrepareTermListModel(modelList, query);
            var gridModel = new DataSourceResult
            {
                Data  = modelList,
                Total = query.TotalCount
            };

            return(Json(gridModel));
        }
Пример #4
0
        public IQueryable <Resource> GetResources(ResourceSearchModel searchModel)
        {
            var result = _context.Resources.AsQueryable();

            //   var result = _context.Resources.Include(d => d.Culture);
            if (searchModel != null)
            {
                if (searchModel.Key != null)
                {
                    result = result.Where(x => x.Key == searchModel.Key);
                }
                //if (!string.IsNullOrEmpty(searchModel.Culture.Name))
                //    result = result.Where(x => x.Culture.Name.Contains(searchModel.Culture.Name));
                //if (searchModel.PriceFrom.HasValue)
                //    result = result.Where(x => x.Price >= searchModel.PriceFrom);
                //if (searchModel.PriceTo.HasValue)
                //    result = result.Where(x => x.Price <= searchModel.PriceTo);
            }
            return(result);
        }