public ActionResult AddOrder() { if (Request.Form["product_id"] != null) { order ord = new order { product_id = Convert.ToInt32(Request.Form["product_id"].ToString()), customer_id = Convert.ToInt32(Request.Form["customer_id"].ToString()), quantity = Convert.ToInt32(Request.Form["quantity"].ToString()), currency_id = Convert.ToInt32(Request.Form["currency_id"].ToString()), supplier_id = Convert.ToInt32(Request.Form["supplier_id"].ToString()), progress = 0 }; db.orders.InsertOnSubmit(ord); try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); // Make some adjustments. // ... // Try again. db.SubmitChanges(); } return RedirectToAction("Index", "Orders"); } List<customer> Customers = new List<customer>(); Customers = db.customers.ToList(); ViewData["Customers"] = Customers; List<currency> Currencies = new List<currency>(); Currencies = db.currencies.ToList(); ViewData["Currencies"] = Currencies; List<supplier> Suppliers = new List<supplier>(); Suppliers = db.suppliers.ToList(); ViewData["Suppliers"] = Suppliers; List<product> model = new List<product>(); model = db.products.ToList(); return View(model); }
private void attach_orders(order entity) { this.SendPropertyChanging(); entity.currency = this; }
private void detach_orders(order entity) { this.SendPropertyChanging(); entity.currency = null; }
private void attach_orders(order entity) { this.SendPropertyChanging(); entity.product = this; }
private void detach_orders(order entity) { this.SendPropertyChanging(); entity.product = null; }
partial void Deleteorder(order instance);
partial void Updateorder(order instance);
partial void Insertorder(order instance);
private void detach_orders(order entity) { this.SendPropertyChanging(); entity.supplier = null; }
private void attach_orders(order entity) { this.SendPropertyChanging(); entity.supplier = this; }