Example #1
0
        public ActionResult SearchResults(SearchViewModel searchInput)
        {
            var model = new SearchResultsViewModel
                            {
                                searchString = searchInput.searchString,
                                Products = new List<Product>()
                            };

            if(model.searchString != null)
                model.Products = new ProductService(Session)
                                        .SearchProductsBy(model.searchString);
            var result = new ViewResult
            {
                ViewData = { Model = model }
            };
            return result;
        }
Example #2
0
 public ActionResult Search(SearchViewModel model)
 {
     return RedirectToAction("SearchResults", model);
 }