public ActionResult Edit([Bind(Include = "TransactionID,Date,Amount,Notes,causeID")] Withdrawel withdrawel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(withdrawel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(withdrawel));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Withdrawel withdrawel = db.Withdrawels.Find(id);

            var causeName = (from g in db.Causes where g.TolAccountID == withdrawel.causeID select g).First();

            withdrawel.cause   = causeName;
            causeName.Balance += withdrawel.Amount;

            db.Transactions.Remove(withdrawel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: /Withdrawel/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Withdrawel withdrawel = db.Withdrawels.Find(id);

            if (withdrawel == null)
            {
                return(HttpNotFound());
            }
            return(View(withdrawel));
        }
        public ActionResult Create([Bind(Include = "TransactionID,Date,Amount,Notes,causeID")] Withdrawel withdrawel)
        {
            if (ModelState.IsValid)
            {
                var causeName = (from g in db.Causes where g.TolAccountID == withdrawel.causeID select g).First();
                withdrawel.cause   = causeName;
                causeName.Balance -= withdrawel.Amount;
                withdrawel.Date    = DateTime.Now;

                db.Transactions.Add(withdrawel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(withdrawel));
        }