I am unable to get a distinct list of 'Order' from my Lambda query. Even though am using the keyword Distinct()
it is still retuing repeated select list item.
public ActionResult Index()
{ var query = _dbContext.Orders .ToList() .Select(x => new SelectListItem { Text = x.OrderID.ToString(), Value = x.ShipCity }) .OrderBy(y => y.Value); ViewBag.DropDownValues = new SelectList(query, "Text", "Value"); retu View();
}
Any suggestions please?