Ejemplo n.º 1
0
        public IEnumerable <Opportunity> GetParentLookup(Guid parentId)
        {
            var accountId = (from o in Context.Opportunities
                             where o.Id == parentId
                             select o.AccountId).Single().Value;

            var account = new AccountQuery(Context).GetItem(accountId);

            return(account.Opportunities);
        }
Ejemplo n.º 2
0
        public void BulkUpdate(Account account)
        {
            var accountEntity =
                Context.Accounts.SingleOrDefault(a =>
                                                 a.Name == account.Name);

            if (accountEntity == null)
            {
                var accountQuery = new AccountQuery(Context);

                account.Id = accountQuery.Create(account);
            }
            else
            {
                account.Id = accountEntity.Id;
            }

            foreach (var opportunity in account.Opportunities)
            {
                opportunity.AccountId = account.Id;

                BulkUpdate(opportunity);
            }
        }