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(); }
private void detach_exchangers1(exchanger entity) { this.SendPropertyChanging(); entity.currency1 = null; }
private void attach_exchangers(exchanger entity) { this.SendPropertyChanging(); entity.currency = this; }
partial void Deleteexchanger(exchanger instance);
partial void Updateexchanger(exchanger instance);
partial void Insertexchanger(exchanger instance);