コード例 #1
0
        public async Task UpdateTenant(TenantEditDto input)
        {
            Tenant byIdAsync = await this.TenantManager.GetByIdAsync(input.Id);

            input.MapTo <TenantEditDto, Tenant>(byIdAsync);
            this.CheckErrors(await this.TenantManager.UpdateAsync(byIdAsync));
        }
コード例 #2
0
ファイル: TenantAppService.cs プロジェクト: llenroc/AbpDemo
        public async Task UpdateTenant(TenantEditDto input)
        {
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            input.MapTo(tenant);
            CheckErrors(await TenantManager.UpdateAsync(tenant));
        }
コード例 #3
0
        public async Task UpdateTenant(TenantEditDto input)
        {
            input.ConnectionString = SimpleStringCipher.Instance.Encrypt(input.ConnectionString);
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            input.MapTo(tenant);
            await TenantManager.UpdateAsync(tenant);
        }
コード例 #4
0
        public async Task UpdateAsync(TenantEditDto input)
        {
            Debug.Assert(input.Id != null, "input.Id != null");
            Tenant tenant = await _tenantRepository.GetAsync(input.Id.Value)
                            ?? throw new UserFriendlyException("租户不存在");

            _mapper.Map(input, tenant);
            await _tenantRepository.UpdateAsync(tenant);
        }
コード例 #5
0
        public async Task <PartialViewResult> EditModal(int id)
        {
            TenantEditDto tenantForEdit = await this._tenantAppService.GetTenantForEdit(new EntityRequestInput(id));

            TenantEditDto          tenantEditDto        = tenantForEdit;
            List <ComboboxItemDto> editionComboboxItems = await this.GetEditionComboboxItems(tenantEditDto.EditionId);

            return(this.PartialView("_EditModal", new EditTenantViewModel(tenantEditDto, editionComboboxItems)));
        }
コード例 #6
0
        public async Task Update(TenantEditDto input)
        {
            input.ConnectionString = SimpleStringCipher.Instance.Encrypt(input.ConnectionString);
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            ObjectMapper.Map(input, tenant);
            tenant.SubscriptionEndUtc = tenant.SubscriptionEndUtc?.ToUniversalTime();

            await TenantManager.UpdateAsync(tenant);
        }
コード例 #7
0
        public async Task UpdateTenant(TenantEditDto input)
        {
            await TenantManager.CheckEditionAsync(input.EditionId, input.IsInTrialPeriod);

            input.ConnectionString = SimpleStringCipher.Instance.Encrypt(input.ConnectionString);
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            ObjectMapper.Map(input, tenant);
            tenant.SubscriptionEndDateUtc = tenant.SubscriptionEndDateUtc?.ToUniversalTime();

            await TenantManager.UpdateAsync(tenant);
        }
コード例 #8
0
        public async Task UpdateTenant(TenantEditDto input)
        {
            input.ConnectionString = SimpleStringCipher.Instance.Encrypt(input.ConnectionString);
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            ObjectMapper.Map(input, tenant);
            await TenantManager.UpdateAsync(tenant);

            if (input.Features != null)
            {
                //更新租户特性
                await TenantManager.SetFeatureValuesAsync(input.Id, input.Features.Select(fv => new NameValue(fv.Name, fv.Value)).ToArray());
            }
        }
コード例 #9
0
ファイル: TenantAppService.cs プロジェクト: nozerowu/ABP
        public async Task UpdateTenant(TenantEditDto input)
        {
            if (await _repository.FirstOrDefaultAsync(t => t.TenancyName == input.TenancyName && t.Id != input.Id) != null)
            {
                throw new UserFriendlyException(string.Format(L("TenancyNameIsAlreadyTaken"), input.TenancyName));
            }

            var tenant = await _repository.FirstOrDefaultAsync(input.Id);
            if (tenant == null)
            {
                throw new AbpException("There is no tenant with id: " + input.Id);
            }

            input.MapTo(tenant);

            await _repository.UpdateAsync(tenant);
        }
コード例 #10
0
        public async Task UpdateTenant(TenantEditDto input)
        {
            if (await _repository.FirstOrDefaultAsync(t => t.TenancyName == input.TenancyName && t.Id != input.Id) != null)
            {
                throw new UserFriendlyException(string.Format(L("TenancyNameIsAlreadyTaken"), input.TenancyName));
            }

            var tenant = await _repository.FirstOrDefaultAsync(input.Id);

            if (tenant == null)
            {
                throw new AbpException("There is no tenant with id: " + input.Id);
            }

            input.MapTo(tenant);

            await _repository.UpdateAsync(tenant);
        }
コード例 #11
0
        public async Task UpdateTenant(TenantEditDto input)
        {
            await TenantManager.CheckEditionAsync(input.EditionId, input.IsInTrialPeriod);

            input.ConnectionString = SimpleStringCipher.Instance.Encrypt(input.ConnectionString);
            var tenant = await TenantManager.GetByIdAsync(input.Id);

            if (tenant.EditionId != input.EditionId)
            {
                EventBus.Trigger(new TenantEditionChangedEventData
                {
                    TenantId     = input.Id,
                    OldEditionId = tenant.EditionId,
                    NewEditionId = input.EditionId
                });
            }

            ObjectMapper.Map(input, tenant);
            tenant.SubscriptionEndDateUtc = tenant.SubscriptionEndDateUtc?.ToUniversalTime();

            await TenantManager.UpdateAsync(tenant);
        }
コード例 #12
0
 public async Task UpdateTenant(TenantEditDto input)
 {
     await ApiClient.PutAsync(GetEndpoint(nameof(UpdateTenant)), input);
 }
コード例 #13
0
ファイル: EditTenantViewModel.cs プロジェクト: wgfs40/Login
 public EditTenantViewModel(TenantEditDto tenant, IReadOnlyList <ComboboxItemDto> editionItems)
 {
     Tenant       = tenant;
     EditionItems = editionItems;
 }
コード例 #14
0
 /// <summary>
 /// 构造
 /// </summary>
 /// <param name="tenant"></param>
 public EditTenantViewModel(TenantEditDto tenant)
 {
     Tenant = tenant;
 }