示例#1
0
 public async Task CreateOrUpdateIconizTeamMember(TeamMemberEditDto input)
 {
     if (!input.Id.HasValue || input.Id.Value == 0)
     {
         await CreateIconizTeamMemberAsync(input);
     }
     else
     {
         await UpdateIconizTeamMemberAsync(input);
     }
 }
示例#2
0
        protected virtual async Task CreateIconizTeamMemberAsync(TeamMemberEditDto input)
        {
            var iconizTeamMember = ObjectMapper.Map <IconizTeamMember>(input);

            if (!string.IsNullOrEmpty(input.ProfilePictureFileName))
            {
                iconizTeamMember.ProfilePictureId = await StoreProfilePicture(input.ProfilePictureFileName);
            }
            await _iconizTeamMemberRepository.InsertAsync(iconizTeamMember);

            await CurrentUnitOfWork.SaveChangesAsync();
        }
示例#3
0
        protected virtual async Task UpdateIconizTeamMemberAsync(TeamMemberEditDto input)
        {
            var iconizTeamMember = await _iconizTeamMemberRepository.GetAsync(input.Id.Value);

            if (!string.IsNullOrEmpty(input.ProfilePictureFileName))
            {
                if (iconizTeamMember.ProfilePictureId.HasValue)
                {
                    await _binaryObjectManager.DeleteAsync(iconizTeamMember.ProfilePictureId.Value);
                }
                input.ProfilePictureId = iconizTeamMember.ProfilePictureId = await StoreProfilePicture(input.ProfilePictureFileName);
            }

            ObjectMapper.Map(input, iconizTeamMember);
            await _iconizTeamMemberRepository.UpdateAsync(iconizTeamMember);

            await CurrentUnitOfWork.SaveChangesAsync();
        }