Пример #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);
        }
Пример #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);
        }