예제 #1
0
        public async Task <string> GetSpeakerProfileAsync(string userPrincipalName,
                                                          SpeakerProfileType speakerProfileType)
        {
            var existing = await _getSpeakerProfileAsync(userPrincipalName, speakerProfileType);

            return(existing?.ProfileId);
        }
예제 #2
0
        private async Task <MappedAuthentication> _getSpeakerProfileAsync(string userPrincipalName,
                                                                          SpeakerProfileType speakerProfileType)
        {
            var existing = await _context.UserMaps.FirstOrDefaultAsync(_ =>
                                                                       _.UserPrinipleName == userPrincipalName && _.ProfileType == speakerProfileType);

            return(existing);
        }
예제 #3
0
        public async Task CreateSpeakerProfileAsync(string userPrincipalName,
                                                    SpeakerProfileType speakerProfileType,
                                                    string profileId)
        {
            var existing = _context.UserMaps.FirstOrDefault(_ => _.UserPrinipleName == userPrincipalName);

            if (existing != null)
            {
                return;
            }

            var newItem = new MappedAuthentication
            {
                UserPrinipleName = userPrincipalName,
                ProfileType      = speakerProfileType,
                ProfileId        = profileId
            };

            await _context.AddAsync(newItem);

            await _context.SaveChangesAsync();
        }