예제 #1
0
 public void DeleteUserAccount(Guid id)
 {
     if (UserAccounts.ContainsKey(id))
     {
         UserAccounts.Remove(id);
     }
 }
예제 #2
0
        public List <AwardItem> GetAwardsForUser(Guid userAccountId)
        {
            if (!UserAccounts.ContainsKey(userAccountId))
            {
                return(new List <AwardItem>());
            }

            return(UserAccounts[userAccountId].Profiles.SelectMany(up => up.Awards).ToList());
        }
예제 #3
0
        public void DeleteProfile(Guid profileId, Guid userAccountId)
        {
            if (!UserAccounts.ContainsKey(userAccountId))
            {
                return;
            }

            UserAccounts[userAccountId].DeleteProfile(profileId);
        }
예제 #4
0
        public UserProfile AddNewUserProfileToAccount(Guid userAccountId, Guid clientId, string emailAddress, List <AwardItem> awards = null)
        {
            if (!UserAccounts.ContainsKey(userAccountId) || !ClientAccounts.ContainsKey(clientId))
            {
                return(null);
            }

            var clientAccount = ClientAccounts[clientId];
            var newProfile    = new UserProfile().CreateUserProfile(Guid.NewGuid(), emailAddress, clientAccount, awards);

            UserAccounts[userAccountId].AddProfile(newProfile);

            return(newProfile);
        }
예제 #5
0
        public UserAccount UpdateUserAccount(Guid id, string firstName, string lastName, string username, string password = null)
        {
            if (!UserAccounts.ContainsKey(id))
            {
                return(null);
            }

            var updatedAccount = new UserAccount().CreateAccount(id, firstName, lastName, username, password);
            var userAccount    = UserAccounts[id];

            userAccount.UpdateAccount(updatedAccount, password);

            return(userAccount);
        }
예제 #6
0
 public UserAccount GetUserAccountById(Guid id)
 {
     return(UserAccounts.ContainsKey(id) ? UserAccounts[id] : null);
 }