public ResponseAccount GetAccountByContactId(ContactIdRequest cidr)
 {
     var contactId = cidr.ContactId;
     var car = from ca in contactAccountRelationships where ca.ContactId.Equals(contactId) select ca;
     if (car.Count() < 1)
     {
         throw new WebFaultException(HttpStatusCode.NoContent);
     }
     else if (car.Count() > 1)
     {
         throw new WebFaultException(HttpStatusCode.Conflict);
     }
     ContactAccountRelationship rel = car.FirstOrDefault();
     AccountNumberRequest anr = new AccountNumberRequest {
         AccountNumber = rel.AccountNumber,
         CustomAttribute = cidr.CustomAttribute
     };
     return GetAccountByAccountNumber(anr);
 }
        public ResponseAccount GetAccountByAccountNumber(AccountNumberRequest req)
        {
            var accountNumber = req.AccountNumber;
            var acc = from account in accounts where account.Number == accountNumber select account;
            if (acc.Count() < 1)
            {
                throw new WebFaultException(HttpStatusCode.NoContent);
            }
            else if (acc.Count() > 1)
            {
                throw new WebFaultException(HttpStatusCode.Conflict);
            }
            ResponseAccount retVal = new ResponseAccount();
            Account retAccount = new Account(acc.FirstOrDefault());

            if (retAccount != null && req.CustomAttribute != null && req.CustomAttribute.Equals("overwrite"))
            {
                retAccount.CustomAttribute = "overwritten custom attribute";
            }

            retVal.Account = retAccount;
            return retVal;
        }
 public ResponseAccount GetAccountByAccountNumber(AccountNumberRequest req)
 {
     ResponseAccount retVal = new ResponseAccount();            
     retVal.Account = SQLGetAccount(config.getAccountByAccountNumber.Replace("%1", req.AccountNumber)); ;
     return retVal;
 }