コード例 #1
0
        public ActionResult EditProfileCollection(int profileCollectionId)
        {
            //Get all profiles
            IOrderedEnumerable <ProfileDetails> allProfiles = _reader.GetProfiles().OrderBy(x => x.Name);

            ProfileCollection profileCollection = _reader.GetProfileCollection(profileCollectionId);

            profileCollection.ProfileCollectionItems = new List <ProfileCollectionItem>();

            profileCollection.Id = profileCollectionId;
            IList <ProfileCollectionItem> profileCollectionItems = _reader.GetProfileCollectionItems(profileCollectionId);

            foreach (ProfileDetails profile in allProfiles)
            {
                profileCollection.ProfileCollectionItems.Add(new ProfileCollectionItem
                {
                    ProfileId      = profile.Id,
                    profileDetails = profile,
                    Selected       = profileCollectionItems.Any(x => x.ProfileId == profile.Id),
                    DisplayDomains =
                        profileCollectionItems.Where(x => x.ProfileId == profile.Id)
                        .Select(x => x.DisplayDomains)
                        .FirstOrDefault()
                });
            }

            if (HttpContext.Request.UrlReferrer != null)
            {
                profileCollection.ReturnUrl = HttpContext.Request.UrlReferrer.ToString();
            }

            return(View("EditProfileCollection", profileCollection));
        }