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(); }
//creating an instance of Donation table (Model) as a parameter public bool commitInsert(Donation don) { //to ensure all data will be disposed of when finished using (objDon) { //using our model to set table columns to new values being passed and providing it to the insert command objDon.Donations.InsertOnSubmit(don); objDon.SubmitChanges(); return true; } }
public ActionResult DonationDelete(int id, Donation don) { try { objDonAdmin.commitDelete(id); return RedirectToAction("Index"); } catch { 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(); }
public ActionResult DonationUpdate(int id, Donation don) { //If all the input were valid , then database will be updated if (ModelState.IsValid) { try { objDonAdmin.CommitUpdate(id, don.first_name, don.last_name, don.country, don.province, don.city, don.city, don.email, don.phone, don.branch_id, don.date, don.amount); return RedirectToAction("Index"); } catch { return View(); } } return View(); }
private void detach_Donations(Donation entity) { this.SendPropertyChanging(); entity.Branch = null; }
private void attach_Donations(Donation entity) { this.SendPropertyChanging(); entity.Branch = this; }
partial void DeleteDonation(Donation instance);
partial void UpdateDonation(Donation instance);
partial void InsertDonation(Donation instance);