public ActionResult ShowProductSearchResults(string searchText) { NorthwindDb db = new NorthwindDb(_connectionString); ProductSearchViewModel vm = new ProductSearchViewModel { Products = db.SearchProducts(searchText), SearchText = searchText }; return(View(vm)); }
public IActionResult SearchResults(int minStock, int maxStock) { NorthwindDb db = new NorthwindDb(@"Data Source=.\sqlexpress;Initial Catalog=Northwnd;Integrated Security=True;"); List <Product> products = db.SearchProducts(minStock, maxStock); SearchProductsViewModel vm = new SearchProductsViewModel { Products = products, MinStock = minStock, MaxStock = maxStock }; return(View(vm)); }