So I have this code:
public ActionResult SearchIndex(string id)
{
string searchString = id;
var members = from m in db.Members
select m;
if (!String.IsNullOrEmpty(searchString))
{
members = members.Where(m => m.town.Equals(searchString));
}
return View(members);
}
This selects all the town names in my database and I've got it to display in a drop down menu.
How can I change this so that when it's displaying the town names, it will only show each town name once.
For example, if I have 3 londons in the database it will show all 3 londons in the drop down menu. I want it to only show 1 london