public ActionResult Index(string productName)
        {
            List <ProductDetailModel> products = productDetailRepository.GetAll();

            if (!string.IsNullOrEmpty(productName))
            {
                products = products.Where(p => p.Name.Contains(productName)).ToList();
            }

            //if (!string.IsNullOrEmpty(productDescription))
            //{
            //    products = products.Where(p => p.Description == productDescription).ToList();
            //}

            var searchModel = new SearchModel
            {
                ProductDetails = new SelectList(products.OrderBy(x => x.Name).Distinct()),
            };

            return(View(searchModel));
        }
Exemplo n.º 2
0
        public ActionResult View(FormCollection collection)
        {
            List <Models.ProductDetailModel> list = productDetailRepository.GetAll();

            return(View("View", list));
        }