示例#1
0
        public IActionResult Index(string url)
        {
            url = string.Format("/{0}", url);

            CachedObject cachedObject = this.Storage.GetRepository <ICachedObjectRepository>().WithCultureIdAndUrl(
                CultureProvider.GetCulture(this.Storage).Id, url
                );

            if (cachedObject == null)
            {
                Object @object = this.Storage.GetRepository <IObjectRepository>().WithUrl(url);

                if (@object == null)
                {
                    return(this.NotFound());
                }

                ObjectViewModel result = new ObjectViewModelBuilder(this).Build(@object);

                return(this.View(result.ViewName, result));
            }

            {
                ObjectViewModel result = new ObjectViewModelBuilder(this).Build(cachedObject);

                return(this.View(result.ViewName, result));
            }
        }
示例#2
0
        public string GetObjectLocalizationValue(int dictionaryId)
        {
            Localization localization = this.handler.Storage.GetRepository <ILocalizationRepository>().WithDictionaryIdAndCultureId(
                dictionaryId, CultureProvider.GetCulture(this.handler.Storage).Id
                );

            if (localization == null)
            {
                return(string.Empty);
            }

            return(localization.Value);
        }
        public override IEnumerable <CachedObject> GetCachedObjects()
        {
            if (this.args.ContainsKey("MemberId"))
            {
                return(this.handler.Storage.GetRepository <ICachedObjectRepository>().Primary(
                           CultureProvider.GetCulture(this.handler.Storage).Id, int.Parse(this.args["MemberId"]), this.cachedObject.ObjectId
                           ));
            }

            return(this.handler.Storage.GetRepository <ICachedObjectRepository>().Primary(
                       CultureProvider.GetCulture(this.handler.Storage).Id, this.cachedObject.ObjectId
                       ));
        }
        public async Task <IViewComponentResult> InvokeAsync(string code)
        {
            CachedMenu cachedMenu = this.Storage.GetRepository <ICachedMenuRepository>().WithCultureIdAndCode(
                CultureProvider.GetCulture(this.Storage).Id, code
                );

            if (cachedMenu == null)
            {
                Menu menu = this.Storage.GetRepository <IMenuRepository>().WithCode(code);

                if (menu == null)
                {
                    return(null);
                }

                return(this.View(new MenuViewModelBuilder(this).Build(menu)));
            }

            return(this.View(new MenuViewModelBuilder(this).Build(cachedMenu)));
        }
示例#5
0
        public async Task <IViewComponentResult> InvokeAsync(string code)
        {
            CachedForm cachedForm = this.Storage.GetRepository <ICachedFormRepository>().WithCultureIdAndCode(
                CultureProvider.GetCulture(this.Storage).Id, code
                );

            if (cachedForm == null)
            {
                Form form = this.Storage.GetRepository <IFormRepository>().WithCode(code);

                if (form == null)
                {
                    return(null);
                }

                return(this.View(new FormViewModelBuilder(this).Build(form)));
            }

            return(this.View(new FormViewModelBuilder(this).Build(cachedForm)));
        }
 public override IEnumerable <CachedObject> GetCachedObjects()
 {
     return(this.handler.Storage.GetRepository <ICachedObjectRepository>().FilteredByCultureId(CultureProvider.GetCulture(this.handler.Storage).Id).Where(o => o.ClassId == int.Parse(this.args["ClassId"])));
 }