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