public ActionResult PurchaseForm(Order ord) { 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 = "_products"; string business = "&[email protected]"; string itm = "&item_name=Buy this product"; string currency = "¤cy_code=CAD"; string amt = "&amount="; string path = url + cmd + value + business + itm + currency + amt; // Inserting the order information into db objOrd.commitInsert(ord); //After inserting, redirect to the paypal return Redirect(path); } catch { //Error handling, return to Error view if something goes wrong return View("Error"); } } return View(); }
public bool commitInsert(Order ord) { using (objOrd) { objOrd.Orders.InsertOnSubmit(ord); //commit insert with db objOrd.SubmitChanges(); return true; } }
partial void DeleteOrder(Order instance);
partial void UpdateOrder(Order instance);
partial void InsertOrder(Order instance);
private void detach_Orders(Order entity) { this.SendPropertyChanging(); entity.Product = null; }
private void attach_Orders(Order entity) { this.SendPropertyChanging(); entity.Product = this; }