public async Task CreateOrUpdateIconizTeamMember(TeamMemberEditDto input) { if (!input.Id.HasValue || input.Id.Value == 0) { await CreateIconizTeamMemberAsync(input); } else { await UpdateIconizTeamMemberAsync(input); } }
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(); }
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(); }