コード例 #1
0
        private List <SelectListItem> GetDeptToList()
        {
            List <SelectListItem> SelectGroupListItems =
                new List <SelectListItem>();

            MasterRepository MasterRepository = new MasterRepository();
            var colRoleSelectList             = MasterRepository.GetDept();

            SelectGroupListItems.Add(
                new SelectListItem
            {
                Text  = "PILIH DEPARTEMEN",
                Value = "0"
            });

            foreach (var item in colRoleSelectList)
            {
                SelectGroupListItems.Add(
                    new SelectListItem
                {
                    Text  = item.Text.ToString(),
                    Value = item.Value.ToString()
                });
            }

            return(SelectGroupListItems);
        }