Exemplo n.º 1
0
        public ProductListQueryBuilder(ProductListSearchCriteria criteria)
            : base(criteria)
        {
            if (criteria.CategoryId.HasValue)
            {
                _category = DaoTemplate.FindByID <Category>(criteria.CategoryId);
            }

            isNewCriteria = criteria.IsNew ? " and p.IsNew = 't' " : " ";

            categories = _category == null?CategoryService.AllVisibleCategories() : _category.ThisAndSubcategories();
        }
Exemplo n.º 2
0
 public ActionResult List(ProductListSearchCriteria searchCriteria)
 {
     ProductListQueryBuilder queryBuilder = new ProductListQueryBuilder(searchCriteria);
     var result = queryBuilder.Execute(daoTemplate.Session);
     Category category = null;
     if (searchCriteria.CategoryId != null)
         category = daoTemplate.FindByID<Category>(searchCriteria.CategoryId);
     return View(new ProductListViewModel(){Category = category, Results = result, IsNew = searchCriteria.IsNew});
 }