コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }