Exemple #1
0
        public async Task <IHttpActionResult> UpdateAccountAsync(string id, AccountInfo accountInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await sf.SFLoginAsync();


            var recordType = "Account";

            var recordFields = new JObject();

            recordFields.Add("Name", accountInfo.AccountName);
            recordFields.Add("OwnerId", accountInfo.AccountOwnerId);
            recordFields.Add("Email__c", accountInfo.Email);
            recordFields.Add("BillingStreet", accountInfo.BillingStreet);
            recordFields.Add("BillingCity", accountInfo.BillingCity);
            recordFields.Add("BillingState", accountInfo.BillingState);
            recordFields.Add("BillingPostalCode", accountInfo.BillingZip);
            recordFields.Add("BillingCountry", accountInfo.BillingCountry);
            recordFields.Add("Phone", accountInfo.Phone);


            var record = await sf.UpdateRecordAsync(id, recordFields, recordType);



            return(Created(new Uri(Request.RequestUri + "/"), record));
        }
Exemple #2
0
        public async Task <IHttpActionResult> UpdateDonationAsync(string id, DonationInfo donationInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await sf.SFLoginAsync();

            var recordType = "Donation__c";

            var recordFields = new JObject();


            recordFields.Add("Name", donationInfo.DonationName);
            recordFields.Add("Amount__c", donationInfo.Amount);
            recordFields.Add("Account_Name__c", donationInfo.AccountId);
            recordFields.Add("Donation_Date__c", donationInfo.DonationDate);


            var record = await sf.UpdateRecordAsync(id, recordFields, recordType);



            return(Created(new Uri(Request.RequestUri + "/"), record));
        }