コード例 #1
0
        public static IEnumerable<SelectListItem> GetOrderedListOfDomainsWithGroupId(ProfileMembers domains, SelectListItem defaultProfile, ProfileRepository profileRepository)
        {
            if (defaultProfile != null)
                domains.Profile = GetProfile(defaultProfile.Value, 0, -1, profileRepository);

            var listOfDomains = new SelectList(domains.Profile.GroupingMetadatas.OrderBy(g => g.Sequence), "GroupId", "GroupName");
            var selectedDomain = new SelectList(listOfDomains, "Value", "Key", listOfDomains.FirstOrDefault().Value).SelectedValue.ToString();
            return listOfDomains.Select(x => new SelectListItem { Selected = (x.Value == selectedDomain), Text = x.Text, Value = x.Value }); ;
        }