public async Task Create_Language()
        {
            //Act
            var output = await _languageAppService.GetLanguageForEdit(new NullableIdDto(null));

            //Assert
            output.Language.Id.ShouldBeNull();
            output.LanguageNames.Count.ShouldBeGreaterThan(0);
            output.Flags.Count.ShouldBeGreaterThan(0);

            //Arrange
            var currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);

            var nonRegisteredLanguages = output.LanguageNames.Where(l => currentLanguages.All(cl => cl.Name != l.Value)).ToList();

            //Act
            var newLanguageName = nonRegisteredLanguages[RandomHelper.GetRandom(nonRegisteredLanguages.Count)].Value;
            await _languageAppService.CreateOrUpdateLanguage(
                new CreateOrUpdateLanguageInput
            {
                Language = new ApplicationLanguageEditDto
                {
                    Icon = output.Flags[RandomHelper.GetRandom(output.Flags.Count)].Value,
                    Name = newLanguageName
                }
            });

            //Assert
            currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);

            currentLanguages.Count(l => l.Name == newLanguageName).ShouldBe(1);
        }
Exemplo n.º 2
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            var output = await _languageAppService.GetLanguageForEdit(new NullableIdDto { Id = id });

            var viewModel = new CreateOrEditLanguageModalViewModel(output);

            return(PartialView("_CreateOrEditModal", viewModel));
        }
Exemplo n.º 3
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            ILanguageAppService languageAppService = this._languageAppService;
            NullableIdInput     nullableIdInput    = new NullableIdInput()
            {
                Id = id
            };
            GetLanguageForEditOutput languageForEdit = await languageAppService.GetLanguageForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrEditModal", new CreateOrEditLanguageModalViewModel(languageForEdit)));
        }
        public override async void OnDialogOpened(IDialogParameters parameters)
        {
            await SetBusyAsync(async() =>
            {
                int?id = null;
                if (parameters.ContainsKey("Value"))
                {
                    id = parameters.GetValue <ApplicationLanguageListDto>("Value").Id;
                }

                await WebRequest.Execute(() =>
                                         appService.GetLanguageForEdit(new NullableIdDto(id)),
                                         GetLanguageForEditSuccessed);
            });
        }