// [AbpAuthorize(PermissionNames.AdminPage_Language)]
        protected virtual async Task CreateLanguageAsync(ApplicationLanguageEditDto input)
        {
            if (AbpSession.MultiTenancySide != MultiTenancySides.Host)
            {
                throw new UserFriendlyException(L("TenantsCannotCreateLanguage"));
            }
            var culture = CultureHelper.GetCultureInfoByChecking(input.Name);

            await CheckLanguageIfAlreadyExists(culture.Name);

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

            await applicationLanguageManager.AddAsync(
                new ApplicationLanguage(
                    AbpSession.TenantId,
                    culture.Name,
                    culture.DisplayName,
                    input.Icon,
                    !input.IsEnabled
                    )


                );
        }
        // [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);
        }
 public async Task CreateOrUpdateLanguage(ApplicationLanguageEditDto input)
 {
     if (input.Id != null)
     {
         await UpdateLanguageAsync(input);
     }
     else
     {
         await CreateLanguageAsync(input);
     }
 }
 public LanguageDetailsViewModel(ILanguageAppService appService)
 {
     language        = new ApplicationLanguageEditDto();
     this.appService = appService;
 }