示例#1
0
        public ActionResult AddExchanger()
        {
            if (Request.Form["currency_id1"] != null && Request.Form["currency_id2"] != null && Request.Form["value"] != null)
            {
                exchanger exch = new exchanger
                {
                    currency_id1 = Convert.ToInt32(Request.Form["currency_id1"].ToString()),
                    currency_id2 = Convert.ToInt32(Request.Form["currency_id2"].ToString()),
                    value = Convert.ToDouble(Request.Form["value"].ToString())
                };

                db.exchangers.InsertOnSubmit(exch);

                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Make some adjustments.
                    // ...
                    // Try again.
                    db.SubmitChanges();
                }
                return RedirectToAction("ExchangerIndex", "Currencies");
            }

            List<currency> Currencies = new List<currency>();
            Currencies = db.currencies.ToList();
            ViewData["Currencies"] = Currencies;

            return View();
        }
示例#2
0
		private void detach_exchangers1(exchanger entity)
		{
			this.SendPropertyChanging();
			entity.currency1 = null;
		}
示例#3
0
		private void attach_exchangers(exchanger entity)
		{
			this.SendPropertyChanging();
			entity.currency = this;
		}
示例#4
0
 partial void Deleteexchanger(exchanger instance);
示例#5
0
 partial void Updateexchanger(exchanger instance);
示例#6
0
 partial void Insertexchanger(exchanger instance);