コード例 #1
0
ファイル: AdminController.cs プロジェクト: kilonet/elfam
 public ActionResult ListProducts(ProductListAdminSearchCriteria searchCriteria)
 {
     ProductListAdminQueryBuilder queryBuilder = new ProductListAdminQueryBuilder(searchCriteria);
     var categories = daoTemplate.FindAll<Category>();
     var result = queryBuilder.Execute(daoTemplate.Session);
     return View(new ProductListViewModel{SearchResults = result, Categories = categories});
 }
コード例 #2
0
 public ProductListAdminQueryBuilder(ProductListAdminSearchCriteria criteria)
     : base(criteria)
 {
     if (criteria.CategoryId.HasValue)
     {
         _category = _daoTemplate.FindByID <Category>(criteria.CategoryId);
     }
 }
コード例 #3
0
        public ProductListAdminSearchCriteria WithCategoryId(int categoryId)
        {
            ProductListAdminSearchCriteria another = this.Clone <ProductListAdminSearchCriteria>();

            another.CategoryId = categoryId;
            // need to reset page index
            another.PageIndex = 1;
            return(another);
        }