Пример #1
0
        public ActionResult AddAccount()
        {
            if (Request.Form["number"] != null)
            {
                account acc = new account
                {
                    number = Request.Form["number"].ToString(),
                    bank = Request.Form["bank"].ToString(),
                    type = Convert.ToInt32(Request.Form["type"].ToString()),
                    value = Convert.ToInt32(Request.Form["value"].ToString()),
                    currency_id = Convert.ToInt32(Request.Form["currency_id"].ToString())
                };
                db.accounts.InsertOnSubmit(acc);
                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Make some adjustments.
                    // ...
                    // Try again.
                    db.SubmitChanges();
                }
                return RedirectToAction("Index", "Accounts");
            }

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

            return View();
        }
Пример #2
0
 partial void Deleteaccount(account instance);
Пример #3
0
 partial void Updateaccount(account instance);
Пример #4
0
 partial void Insertaccount(account instance);
Пример #5
0
		private void detach_accounts(account entity)
		{
			this.SendPropertyChanging();
			entity.currency = null;
		}
Пример #6
0
		private void attach_accounts(account entity)
		{
			this.SendPropertyChanging();
			entity.currency = this;
		}