Exemple #1
0
        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);
        }
Exemple #2
0
		private void attach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.currency = this;
		}
Exemple #3
0
		private void detach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.currency = null;
		}
Exemple #4
0
		private void attach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.product = this;
		}
Exemple #5
0
		private void detach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.product = null;
		}
Exemple #6
0
 partial void Deleteorder(order instance);
Exemple #7
0
 partial void Updateorder(order instance);
Exemple #8
0
 partial void Insertorder(order instance);
Exemple #9
0
		private void detach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.supplier = null;
		}
Exemple #10
0
		private void attach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.supplier = this;
		}