public List<SelectListItem> GetAllShows(AdareContext db) { var res = new List<SelectListItem>(); db.AdareShows.ToList().ForEach(s => res.Add(GetEventItem(s))); if (res.Count > 0) { res[0].Selected = true; } return res; }
public List<SelectListItem> GetShows(ShowType tp, AdareContext db) { var res = new List<SelectListItem>(); var showlist = db.AdareShows.Where(p => p.EventTypeId == (int)tp); showlist.ToList().ForEach(s => res.Add(GetEventItem(s))); // allow null in select list res.Add(new SelectListItem { Selected = true, Text = String.Empty, Value = "0", }); return res; }