Beispiel #1
0
        public List <SelectListItem> List(List <string> SelectedItems = null)
        {
            var Items = _db.Facility.ToList();

            if (SelectListItems == null)
            {
                SelectListItems = new List <SelectListItem>();
            }
            //var SelectList = new List<SelectListItem>();
            //var SelectedItems = SelectedItems;
            foreach (var item in Items)
            {
                SelectListItems.Add(new SelectListItem
                {
                    Text     = item.Text,
                    Value    = item.ID.ToString(),
                    Selected = SelectedItems == null ? false :
                               (SelectedItems.Contains(item.ID.ToString())?true:false)
                });
            }

            return(SelectListItems);
        }
Beispiel #2
0
        public void Scenic()
        {
            var Items = _db.Scenic.ToList();

            if (SelectListItems == null)
            {
                SelectListItems = new List <SelectListItem>();
            }
            //var SelectList = new List<SelectListItem>();
            //var SelectedItems = SelectedItems;
            foreach (var item in Items)
            {
                SelectListItems.Add(new SelectListItem
                {
                    Text     = item.Name,
                    Value    = item.ID.ToString(),
                    Selected = SelectedItems == null ? false :
                               (SelectedItems.Contains(item.ID.ToString())?true:false)
                });
            }

            //return SelectList;
        }