var name = (from s in db.Products
orderby s.ID
select s.Name).Distinct();
ViewBag.Pname = new SelectList(name);
if (!string.IsNullOrEmpty(pname))
{
var products = from s in db.Products
where s.Name == pname
select s;
return View(products);
}
return View(db.Products.ToList());