public ActionResult Data(string searchText = null)
        {
            InitPageModel();
            ConfigureWithProfile(new ProfileDetailsBuilder(UrlKey).Build());

            ProfileDetails templateProfile = new ProfileDetailsBuilder(PageModel.Skin.TemplateProfileUrlKey).Build();

            // Override according to skin
            ViewBag.DefaultAreaType = templateProfile.DefaultAreaType;
            ViewBag.EnumParentDisplay = templateProfile.EnumParentDisplay;
            ViewBag.ExtraJsFiles = templateProfile.ExtraJavaScriptFiles.Concat(ViewBag.ExtraJsFiles as IList<string>);
            ViewBag.ExtraCssFiles = templateProfile.ExtraCssFiles;

            PageModel.PageTitle = TitleSearchResults;
            ViewBag.SearchText = searchText ?? string.Empty;

            PageModel.RagColourId = templateProfile.RagColourId;
            PageModel.StartZeroYAxis = templateProfile.StartZeroYAxis;
            PageModel.DefaultFingertipsTabId = templateProfile.DefaultFingertipsTabId;
            PageModel.IgnoredSpineChartAreas = templateProfile.AreasToIgnoreForSpineCharts;

            //Check to see if there's a profileCollection added for the current skin. Restrict the search to just the profiles of this ProfileCollection if there is.
            GetProfileCollection();
            var searchableProfiles =
                PageModel.ProfileCollections.SelectMany(x => x.ProfileCollectionItems)
                    .Select(c => c.ProfileId)
                    .ToArray();

            PageModel.ProfileCollectionIdList = searchableProfiles;
            PageModel.TemplateProfileId = templateProfile.Id;

            return View(GetViewName(), PageModel);
        }
        protected ProfileDetails ConfigureFingertipsProfileAndPageModelWithProfileDetails(string profileKey)
        {
            ProfileDetails details = new ProfileDetailsBuilder(profileKey).Build();

            if (details != null)
            {
                ConfigureWithProfile(details);
                CheckSkinIsNotLongerLives();
            }
            return details;
        }
        public void TestValidKey()
        {
            ProfileDetails details = new ProfileDetailsBuilder(
                ProfileUrlKeys.SevereMentalIllness).Build();

            Assert.AreEqual(ProfileIds.SevereMentalIllness, details.Id);
            Assert.IsNotNull(details.Title);
            Assert.AreEqual(ProfileUrlKeys.SevereMentalIllness, details.ProfileUrlKey);

            Assert.AreEqual(6, details.Domains.Count);
            Assert.AreEqual(GroupIds.SevereMentalIllness_RiskFactors, 
                details.Domains[0].GroupId);
            Assert.AreEqual(GroupIds.SevereMentalIllness_Finance, 
                details.Domains[4].GroupId);
        }
        private void AddProfileDetails(ProfileCollection profileCollection)
        {
            var isLive = config.IsEnvironmentLive;

            foreach (var item in profileCollection.ProfileCollectionItems)
            {
                var profileDetails = new ProfileDetailsBuilder(item.ProfileId).Build();
                item.ProfileDetails = profileDetails;
                if (profileDetails.HasExclusiveSkin)
                {
                    var skin = profileReader.GetSkinFromId(profileDetails.SkinId);
                    item.ExternalUrl = isLive ?
                        skin.LiveHost :
                        skin.TestHost;
                }
            }
        }
 public void InitPage(string profileKey, string pageName)
 {
     var profileDetails = new ProfileDetailsBuilder(profileKey).Build();
     ConfigureWithProfile(profileDetails);
     PageModel.PageTitle = pageName;
 }