UAccountsData() public method

public UAccountsData ( System.Guid userId ) : HashSetBlob
userId System.Guid
return HashSetBlob
Exemplo n.º 1
0
        public void SetAdminId(Guid accountId, Guid userId)
        {
            //Blob<Guid> bAdmin = new Blob<Guid>(connexion.accountContainer, Path.A_ADMINID + accountId);
            Blob <HashSet <Guid> > bUserAccounts = blobFactory.UAccountsData(userId);

            using (blobFactory.UAccountsLock(userId))
            {
                HashSet <Guid> userAccounts = bUserAccounts.Get();
                // we check if the user is already on this account
                if (!userAccounts.Contains(accountId))
                {
                    if (!blobFactory.AUsers(accountId).AddWithRetry(userId))
                    {
                        throw new AccountNotFound();
                    }

                    userAccounts.Add(accountId);
                    bUserAccounts.Set(userAccounts);
                }

                if (!blobFactory.AAdminId(accountId).SetIfExists(userId))
                {
                    userAccounts.Remove(accountId);
                    bUserAccounts.Set(userAccounts);
                    throw new AccountNotFound();
                }
            }
        }
Exemplo n.º 2
0
 public HashSet <Guid> GetAccounts(Guid userId)
 {
     return(blobFactory.UAccountsData(userId).GetIfExists(new UserNotFound()));
 }