Beispiel #1
0
        public ActionResult Register()
        {
            SelectList sl = new SelectList(_iStationEntityRepos.GetAllTeams(), "TeamEntityId", "TeamName");

            ViewBag.sl = sl;
            return(View());
        }
Beispiel #2
0
        /// <summary>
        /// 获取team生成selectlist
        /// </summary>
        private void GetTeamValueAndSetViewBag()
        {
            var        allTeams = _iStationEntityRepos.GetAllTeams();
            SelectList sl       = new SelectList(allTeams, "TeamEntityId", "TeamName");

            ViewBag.sl = sl;
        }
Beispiel #3
0
        private List <SelectListItem> GetSelectListItems()
        {
            var re     = _iStationEntityRepos.GetAllTeams();
            var result = (from teamEntity in re
                          from stationEntity in teamEntity.StationEntities
                          select new SelectListItem()
            {
                Group = new SelectListGroup()
                {
                    Name = teamEntity.TeamName
                },
                Text = stationEntity.StationName,
                Value = stationEntity.StationId.ToString()
            }).ToList();

            return(result);
        }