Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="email"></param>
        /// <returns>the respectively id. Empty Guid if email is not exist in db.</returns>
        public Guid ParseEmailToGuid(string email)
        {
            if (MappedEmail.ContainsKey(email.ToLower()))
            {
                return(MappedEmail[email.ToLower()]);
            }

            ChatUserProfile profile = new UserProfileStore().LoadByEmail(email);

            if (profile == null)
            {
                return(Guid.Empty);
            }

            MappedEmail.TryAdd(email.ToLower(), profile.ID);
            StoredProfiles.AddReplace(profile.ID, profile);

            return(profile.ID);
        }
Exemplo n.º 2
0
        public ChatUserProfile GetUserProfile(Guid id)
        {
            if (StoredProfiles.Contains(id))
            {
                return(StoredProfiles.Get(id));
            }

            ChatUserProfile profile = new UserProfileStore().LoadById(id);

            if (profile == null)
            {
                return(null);
            }

            StoredProfiles.AddReplace(profile.ID, profile);
            MappedEmail.TryAdd(profile.Email.ToLower(), profile.ID);

            return(profile);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            _dbContext = new Mock <IApplicationDbContext>();

            _userProfileStore = new UserProfileStore(_dbContext.Object);
        }