Exemplo n.º 1
0
        public virtual IActionResult List(ConstructionCapitalSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageConstructionCapital))
            {
                return(AccessDeniedKendoGridJson());
            }

            //prepare model
            var model = _constructionModelFactory.PrepareConstructionCapitalListModel(searchModel);

            return(Json(model));
        }
        public ConstructionCapitalSearchModel PrepareConstructionCapitalSearchModel(ConstructionCapitalSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //prepare page parameters
            searchModel.SetGridPageSize();

            return(searchModel);
        }
        public ConstructionCapitalListModel PrepareConstructionCapitalListModel(ConstructionCapitalSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get items
            var items = _constructionCapitalService.GetConstructionCapitalsByName(searchModel.Name);

            //prepare list model
            var model = new ConstructionCapitalListModel
            {
                //fill in model values from the entity
                Data  = items.PaginationByRequestModel(searchModel).Select(store => store.ToModel <ConstructionCapitalModel>()),
                Total = items.Count
            };

            return(model);
        }