internal TDto GetSubsiteInfo <TDto>(object instanceId, IDataConverter <SubsiteInfoData, TDto> converter)
            where TDto : class
        {
            ISubsiteService service = UnitOfWork.GetService <ISubsiteService>();
            var             query   = service.GetSubsiteInfo(instanceId);

            if (query.HasResult)
            {
                return(query.DataToDto(converter));
            }

            return(null);
        }
Exemple #2
0
        //[OutputCache(Duration = 300)]
        public ViewResult Index(string urlAlias)
        {
            try
            {
                if (urlAlias.EndsWith("/"))
                {
                    urlAlias = urlAlias.TrimEnd('/');
                }
                ReferenceInfoDto reference = null;
                if (CurrentLanguage.Id == WebContext.Current.DefaultLanguage.Id)
                {
                    reference = Service.GetReference(urlAlias, null);
                }
                else
                {
                    reference = Service.GetReference(urlAlias, CurrentLanguage.Id);
                }
                if (reference == null)
                {
                    throw new HttpException(404, string.Format("Page {0} doesn't exist.", HttpContext.Request.RawUrl));
                }

                PageViewModel model = new PageViewModel(reference, HttpContext.Request.Url, PageIndex, CurrentLanguage);
                model.Populate();

                // Set info for subsite
                if (reference.SubsiteId != null)
                {
                    ISubsiteService subsiteService = ServiceLocator.Current.GetInstance <ISubsiteService>();
                    SubsiteInfoDto  subsite        = subsiteService.GetSubsiteInfo(reference.SubsiteId);
                    // Setup sub site parameters
                    model.PopulateSubsite(subsite);
                }

                return(View(model));
            }
            catch
            {
                throw;
            }
        }