public ActionResult Products(string productType, string color) { ViewBag.ProductType = productType; ViewBag.Color = color; List <ProductInfo> list = ProductInfo.GetAll(); IEnumerable <ProductInfo> result = list.Where( m => (string.IsNullOrEmpty(productType) || m.ProductType.IndexOf(productType) >= 0) && (string.IsNullOrEmpty(color) || m.Color.IndexOf(color) >= 0)); return(View(result)); }