//
        // GET: /PrisonerTransaction/Create

        public ActionResult Create()
        {
            var transaction = new PrisonerTransaction();

            PopulateDropDowns(transaction);
            return(View(transaction));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            PrisonerTransaction transaction = db.PrisonerTransactions.Find(id);

            db.PrisonerTransactions.Remove(transaction);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //
        // GET: /PrisonerTransaction/Details/5

        public ActionResult Details(int id = 0)
        {
            PrisonerTransaction transaction = db.PrisonerTransactions.Find(id);

            if (transaction == null)
            {
                return(HttpNotFound());
            }
            return(View(transaction));
        }
        //
        // GET: /PrisonerTransaction/Edit/5

        public ActionResult Edit(int id = 0)
        {
            PrisonerTransaction transaction = db.PrisonerTransactions.Find(id);

            if (transaction == null)
            {
                return(HttpNotFound());
            }
            PopulateDropDowns(transaction);
            return(View(transaction));
        }
        public ActionResult Edit(PrisonerTransaction transaction)
        {
            if (ModelState.IsValid)
            {
                db.Entry(transaction).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ValidationError();
            PopulateDropDowns(transaction);
            return(View(transaction));
        }
        public ActionResult Create(PrisonerTransaction transaction)
        {
            if (ModelState.IsValid)
            {
                db.PrisonerTransactions.Add(transaction);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ValidationError();
            PopulateDropDowns(transaction);
            return(View(transaction));
        }
 private void PopulateDropDowns(PrisonerTransaction transaction)
 {
     ViewBag.TransactionType = new SelectList(Enum.GetValues(typeof(TransactionType)), transaction.TransactionType);
 }