public async Task UpdateTenantAsync(UpdateTenantInput input) { var tenant = await _tenantRepository.GetAsync(input.Tenant.Id); input.Tenant.MapTo(tenant); await _tenantRepository.UpdateAsync(tenant); }
public void DeleteTenant(UpdateTenantInput input) { //We can use Logger, it's defined in ApplicationService base class. Logger.Info("Updating a tenant for input: " + input); //Retrieving a tenant entity with given id using standard Get method of repositories. var tenant = this.tenantRepository.Get(input.Id); this.tenantRepository.Delete(tenant); }
public void UpdateTenant(UpdateTenantInput input) { //We can use Logger, it's defined in ApplicationService base class. Logger.Info("Updating a tenant for input: " + input); //Retrieving a tenant entity with given id using standard Get method of repositories. var tenant = this.tenantRepository.Get(input.Id); //Updating changed properties of the retrieved tenant entity. tenant.IsActive = input.IsActive; tenant.Name = input.Name; tenant.TenancyName = input.Name; //We even do not call Update method of the repository. //Because an application service method is a 'unit of work' scope as default. //ABP automatically saves all changes when a 'unit of work' scope ends (without any exception). }
public async Task <string> Update(UpdateTenantInput input) { var tenant = await _tenantRepository.SingleOrDefaultAsync(p => p.Id == input.Id); if (tenant == null) { throw new BusinessException($"不存在Id为{input.Id}的租户信息"); } if (!input.Name.Equals(tenant.Name)) { var exsitTenant = await _tenantRepository.FirstOrDefaultAsync(p => p.Name == input.Name.Trim()); if (exsitTenant != null) { throw new BusinessException($"已经存在{input.Name}的租户"); } } tenant = input.MapTo(tenant); await _tenantRepository.UpdateAsync(tenant); return("更新租户信息成功"); }
public async Task <JsonResult> UpdateTenant(UpdateTenantInput input) { await _tenantAppService.UpdateTenantAsync(input); return(Json(true, JsonRequestBehavior.AllowGet)); }
public async Task <string> Update(UpdateTenantInput input) { input.CheckDataAnnotations().CheckValidResult(); return(await _tenantDomainService.Update(input)); }