public List <CrmObject.Account> GetAllAccounts() { using (var ctx = new XRMContext(_crmService)) { return((from act in ctx.AccountSet select act).ToList()); } }
public List <CrmObject.Account> GetChildAccountsForAnAccount(EntityReference parentAccount) { if (parentAccount == null) { throw new ArgumentNullException(nameof(parentAccount)); } using (var ctx = new XRMContext(_crmService)) { return((from act in ctx.AccountSet where act.ParentAccountId.Id == parentAccount.Id select act).ToList()); } }