Exemplo n.º 1
0
        public async Task <IActionResult> About()
        {
            var apiService    = _configuration.GetApiServiceInfo();
            var listCoreValue = await _coreService.GetAllActivatedCoreValueAsync(apiService.TenantId, CultureInfo.CurrentCulture.Name);

            if (listCoreValue != null)
            {
                ViewBag.ListCoreValue = JsonConvertHelper.GetObjectFromObject <List <ValueViewModel> >(listCoreValue);
            }

            if (_cache.TryGetValue($"{CacheParam.MenuMiddle}{CultureInfo.CurrentCulture.Name}", out MenuDetailViewModel CategoryMiddleCache))
            {
                ViewBag.MenuContact = CategoryMiddleCache;
            }
            else
            {
                var menuMiddle = await _menuService.GetAllActivatedMenuByPositionAsync(apiService.TenantId, CultureInfo.CurrentCulture.Name, WebsiteClient.Api.Domain.Constants.Position.Middle);

                var menuMiddleData = JsonConvertHelper.GetObjectFromObject <MenuDetailViewModel>(menuMiddle);
                _cache.Set($"{CacheParam.MenuMiddle}{CultureInfo.CurrentCulture.Name}", menuMiddleData, TimeSpan.FromHours(1));
                ViewBag.MenuContact = menuMiddleData;
            }

            return(View());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetAllActivatedCoreValue(string tenantId, string languageId)
        {
            var result = await _coreValueService.GetAllActivatedCoreValueAsync(tenantId, languageId ?? CultureInfo.CurrentCulture.Name);

            return(Ok(result));
        }