public ActionResult Search(int? clientNo = null, string clientName = null) >> { >> // Assume we want to select everything >> var clients = Db.Clients; // Should set type of clients to IQueryable<Clients> >> >> if ((clientNo??0) != 0) //Number was supplied >> clients = clients.Where(c => (c.Number == clientNo)); >> >> // If clientNo was supplied, clients is now filtered by that. If not, it still has the full list. The following will further filter it. >> if (!String.IsNullOrWhitespace(clientName) ) // Part of the name was supplied >> clients = clients.Where(c => (c.Name.Contains(clientName))); >> >> // Order the filtered list >> clients = clients.OrderBy(c => c.Name); >> >> return PartialView("_ClientsSearch", clients); >> }>