public async Task <ActionResult> UpdateAsync(string id) { var sf = new SalesforceTools(); await sf.SFLoginAsync(); var account = await sf.FindRecordAsync(id, "Account"); var ownerName = await sf.FindRecordAsync(account["OwnerId"].ToString(), "User"); var accountInfo = new AccountInfo() { Id = account["Id"].ToString(), AccountName = account["Name"].ToString(), AccountOwnerId = account["OwnerId"].ToString(), OwnerName = ownerName["Name"].ToString(), BillingStreet = account["BillingStreet"].ToString(), BillingCity = account["BillingCity"].ToString(), BillingState = account["BillingState"].ToString(), BillingZip = account["BillingPostalCode"].ToString(), BillingCountry = account["BillingCountry"].ToString(), Phone = account["Phone"].ToString(), Email = account["Email__c"].ToString() }; return(View("AccountForm", accountInfo)); }
public async Task <JObject> GetDonationsAsync() { await sf.SFLoginAsync(); var recordType = "Donation__c"; var fields = new List <string> { "id", "name", "amount__c", "donation_date__c" }; return(await sf.FindRecordAsync(recordType : recordType, fields : fields)); }
public async Task <JToken> GetAccountsAsync(string query = null) { await sf.SFLoginAsync(); var record = "User"; var fields = new List <string> { "id", "name" }; var accounts = await sf.FindRecordAsync(recordType : record, fields : fields, query : query); return(accounts["records"]); }
public async Task <ActionResult> UpdateAsync(string id) { var sf = new SalesforceTools(); await sf.SFLoginAsync(); var donation = await sf.FindRecordAsync(id, "Donation__c"); var accountName = await sf.FindRecordAsync(donation["Account_Name__c"].ToString(), "Account"); var donationInfo = new DonationInfo() { Id = donation["Id"].ToString(), DonationName = donation["Name"].ToString(), AccountId = donation["Account_Name__c"].ToString(), Amount = (int)donation["Amount__c"], DonationDate = donation["Donation_Date__c"].ToString(), AccountName = accountName["Name"].ToString() }; return(View("DonationForm", donationInfo)); }