Example #1
0
 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});
 }
Example #2
0
 public ProductListAdminQueryBuilder(ProductListAdminSearchCriteria criteria)
     : base(criteria)
 {
     if (criteria.CategoryId.HasValue)
     {
         _category = _daoTemplate.FindByID <Category>(criteria.CategoryId);
     }
 }
Example #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);
        }