public ProductViewModel()
            : base()
        {
            //TODO use dependency injection.
            _productRepository = new ProductRepository();

            Products     = new List <Product>();
            SearchEntity = new SearchProductFilter();
            Entity       = new Product();
        }
Exemple #2
0
        public List <Product> Search(SearchProductFilter filter)
        {
            //TODO Use non mocked data
            var products = GetProductsQueryableData();

            if (filter != null)
            {
                if (!string.IsNullOrEmpty(filter.Name))
                {
                    products = products
                               .Where(product => product.Name != null &&
                                      product.Name.StartsWith(filter.Name, StringComparison.InvariantCultureIgnoreCase));
                }
            }

            return(products.ToList());
        }
        protected override void ResetSearch()
        {
            SearchEntity = new SearchProductFilter();

            base.ResetSearch();
        }