public ActionResult DonationInsert(Donation don) { if (ModelState.IsValid) { try { //these part of code is for creating the url which redirect to paypal (connect us to paypal) string url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; string cmd = "?cmd="; string value = "_donations"; string business = "&[email protected]"; string itm = "&item_name=Donate to Riverside HealthCare"; string currency = "¤cy_code=CAD"; string amt = "&amount=" + don.amount.ToString(); string path = url + cmd + value + business + itm + currency + amt; // Inserting the donor information into db objDon.commitInsert(don); //After inserting, redirect to the paypal return(Redirect(path)); } catch { //Error handling, return to Donation view if something goes wrong return(View()); } } return(View()); }
public ActionResult DonationInsert(Donation don) { if (ModelState.IsValid) { try { objDonAdmin.commitInsert(don); return(RedirectToAction("Index")); //On sucessful insert, redirect to the index view } catch { //Error handling, return to Donation view if something goes wrong return(View()); } } return(View()); }