public List <SelectListItem> SelectList(List <int> Selected = null) { var lang = HttpContext.Current.Request.Cookies["lang"].Value.ToLower(); var _db = new WGHotelsEntities(); object model = null; if (lang == "us") { model = _db.CodeFileEN.Where(o => o.ItemType == "Bed").ToList(); } else { model = _db.CodeFileZH.Where(o => o.ItemType == "Bed").ToList(); } var Beds = (List <CodeFileZH>)model; var SelectList = new List <SelectListItem>(); foreach (var i in Beds) { SelectList.Add(item: new SelectListItem { Text = i.ItemDescription, Value = i.ID.ToString(), Selected = Selected == null ? false : Selected.Contains(i.ID) }); } _db.Dispose(); return(SelectList); }
public List <SelectListItem> SelectList(List <int> Selected = null) { var Items = new List <GameSiteViewModel>(); var _db = new WGHotelsEntities(); object Games = null; Games = _db.VenueZH.Where(o => o.Deleted != true).ToList(); var SelectList = new List <SelectListItem>(); foreach (var i in (List <VenueZH>)Games) { SelectList.Add(item: new SelectListItem { Text = string.Format("{0}/{1}/{2}", i.Type, i.Venue, i.Sport), Value = i.ID.ToString(), Selected = Selected == null ? false : Selected.Contains(i.ID) }); } _db.Dispose(); return(SelectList); }