Exemplo n.º 1
0
        public async Task ChangeState(int?tenantId, int langid, bool state)
        {
            var Language = _applicationLanguage.FirstOrDefault(langid);

            Language.IsDisabled = state;
            await _languageManager.UpdateAsync(null, Language);
        }
Exemplo n.º 2
0
        // [AbpAuthorize(PermissionNames.AdminPage_Language)]
        protected virtual async Task UpdateLanguageAsync(ApplicationLanguageEditDto input)
        {
            if (input.Id == null)
            {
                throw new UserFriendlyException(L("Không tìm thấy entity"));
            }

            var culture = CultureHelper.GetCultureInfoByChecking(input.Name);

            await CheckLanguageIfAlreadyExists(culture.Name, input.Id.Value);

            input.Icon = FamFamFamFlagsHelper
                         .FlagClassNames
                         .Where(p => FamFamFamFlagsHelper.GetCountryCode(p) == input.Name)
                         .Select(p => p)
                         .FirstOrDefault();

            var language = await languageRepository.GetAsync(input.Id.Value);

            language.Name        = culture.Name;
            language.DisplayName = culture.DisplayName;
            language.Icon        = input.Icon;
            language.IsDisabled  = !input.IsEnabled;

            await applicationLanguageManager.UpdateAsync(AbpSession.TenantId, language);
        }
Exemplo n.º 3
0
        public async Task <LanguageDto> Update(LanguageDto input)
        {
            var language = ObjectMapper.Map <ApplicationLanguage>(input);
            await _appLanguageManager.UpdateAsync(AbpSession.TenantId, language);

            return(ObjectMapper.Map <LanguageDto>(language));
        }
Exemplo n.º 4
0
        protected virtual async Task UpdateLanguageAsync(CreateOrUpdateLanguageInput input)
        {
            Debug.Assert(input.Language.Id != null, "input.Language.Id != null");

            var culture  = GetCultureInfoByChecking(input.Language.Name);
            var language = await _languageRepository.GetAsync(input.Language.Id.Value);

            language.Name        = culture.Name;
            language.DisplayName = culture.DisplayName;
            language.Icon        = input.Language.Icon;

            await _applicationLanguageManager.UpdateAsync(AbpSession.TenantId, language);
        }
        protected virtual async Task UpdateLanguageAsync(CreateOrUpdateLanguageInput input)
        {
            Debug.Assert(input.Language.Id != null, "input.Language.Id != null");

            var culture = CultureHelper.GetCultureInfo(input.Language.Name);

            if (await LanguageExists(culture.Name, input.Language.Id.Value))
            {
                throw new UserFriendlyException(L("ThisLanguageAlreadyExists"));
            }

            var language = await _languageRepository.GetAsync(input.Language.Id.Value);

            language.Name        = culture.Name;
            language.DisplayName = culture.DisplayName;
            language.Icon        = input.Language.Icon;
            language.IsDisabled  = !input.Language.IsEnabled;

            await _languageManager.UpdateAsync(AbpSession.TenantId, language);
        }