Beispiel #1
0
        public async Task DeleteAsync(BatchInput <long> input)
        {
            foreach (var id in input.Ids)
            {
                var picture = await _pictureManager.GetByIdAsync(id);

                //删除云存储资源文件
                await _storageProvider.DeleteAsync(picture.Key);

                await _pictureManager.DeleteAsync(picture);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 清除Logo
        /// </summary>
        /// <returns></returns>
        public async Task ClearLogo()
        {
            var tenant = await GetCurrentTenantAsync();

            if (!tenant.HasLogo())
            {
                return;
            }

            await _pictureManager.DeleteAsync(tenant.LogoId);

            tenant.ClearLogo();
        }
Beispiel #3
0
        /// <summary>
        /// 更新头像
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task UpdateProfilePicture(UpdateProfilePictureInput input)
        {
            var userAccount = await _userAccountManager.GetByUserIdAsync(AbpSession.GetTenantId(), AbpSession.GetUserId());

            if (userAccount.ProfilePictureId > 0)
            {
                await _pictureManager.DeleteAsync(userAccount.ProfilePictureId);
            }

            userAccount.ProfilePictureId = input.ProfilePictureId;
        }
Beispiel #4
0
        /// <summary>
        /// 更新租户资料
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task UpdateTenantInfo(TenantInfoEditDto input)
        {
            if (!AbpSession.TenantId.HasValue)
            {
                throw new UserFriendlyException(L("CanNotFindTenant"));
            }

            var tenant = await TenantManager.GetByIdAsync(AbpSession.TenantId.Value);

            if (input.LogoId != tenant.LogoId)
            {
                await _pictureManager.DeleteAsync(tenant.LogoId);

                tenant.LogoId = input.LogoId;
            }

            if (input.BackgroundPictureId != tenant.BackgroundPictureId)
            {
                await _pictureManager.DeleteAsync(tenant.BackgroundPictureId);

                tenant.BackgroundPictureId = input.BackgroundPictureId;
            }

            if (input.TenancyName != tenant.Name)
            {
                var user = await _userManager.UserStore.FindMainUser4PlatformByTenantIdAsync(tenant.Id);

                user.UserName           = input.TenancyName;
                user.NormalizedUserName = input.TenancyName.ToLower();
                await _userManager.UpdateAsync(user);

                await TenantManager.ChangeTenantNameAsync(tenant, input.TenancyName);
            }

            tenant.Description = input.Description;
            tenant.Tagline     = input.Tagline;
            await TenantManager.UpdateAsync(tenant);
        }