Esempio n. 1
0
        private async Task GetCulturesListAsync()
        {
            (var cultures, var _) = await _culManager.CulturesListAsync(1, 848, null);

            Cultures = cultures.Select(x => new SelectListItem
            {
                Text  = x.EnglishName,
                Value = x.ID,
            });
        }
Esempio n. 2
0
        public async Task <(IEnumerable <XDbCulture> items, int total)> ListSupportedCulturesAsync()
        {
            var expList = new List <Expression <Func <XDbCulture, bool> > > {
            };

            if (!string.IsNullOrWhiteSpace(Q))
            {
                expList.Add(x => x.ID != null && x.ID.Contains(Q) || x.EnglishName != null && x.EnglishName.Contains(Q));
            }

            if (Def != null)
            {
                expList.Add(x => x.IsDefault == Def);
            }

            if (Act != null)
            {
                expList.Add(x => x.IsActive == Act);
            }

            return(await _culManager.CulturesListAsync(P, S, expList));
        }
Esempio n. 3
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (ResourceID == 0)
            {
                TempData.Warning("Resource ID can't be zero!");
                return(RedirectToPage("Resources"));
            }

            var res = await _resManager.GetResourceAsync <XDbResource>(x => x.ID == ResourceID);

            var exp = new List <Expression <Func <XDbResource, bool> > > {
                x => x.Key == res.Key
            };

            int _;

            (Resources, _) = await _resManager.ResourcesSetListAsync(1, 848, exp);

            if (Resources == null)
            {
                TempData.Danger("Resource not found!");
                return(RedirectToPage("Index"));
            }

            var culturesExp = new List <Expression <Func <XDbCulture, bool> > > {
            };

            if (!string.IsNullOrWhiteSpace(TargetCulture))
            {
                culturesExp.Add(x => x.ID == TargetCulture);
            }

            _             = 0;
            (Cultures, _) = await _culManager.CulturesListAsync(1, 848, null);

            DefaultCulture = Cultures?.SingleOrDefault(c => c.IsDefault == true)?.ID;

            return(Page());
        }