public ActionResult Create([Bind(Include = "Id, Employee, RequestDate, GrantType, Description, Amount, CersNumber, CersDate, PaymentNumber, PaymentDate, Notes")] ExternalGrant externalGrant)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    ExternalGrantServices.Insert(CurrentUser.Id, externalGrant, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.EmployeeList  = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            ViewBag.GrantTypeList = new SelectList(GrantTypeServices.List(db), "Id", "Name");
            return(View(externalGrant));
        }
        // GET: ExternalGrant/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db            db            = new Db(DbServices.ConnectionString);
            ExternalGrant externalGrant = ExternalGrantServices.Get(id.Value, db);

            if (externalGrant == null)
            {
                return(HttpNotFound());
            }
            return(View(externalGrant));
        }
        // GET: ExternalGrant/Edit/5
        public ActionResult Edit(Nullable <int> id)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExternalGrant externalGrant = ExternalGrantServices.Get(id.Value, db);

            if (externalGrant == null)
            {
                return(HttpNotFound());
            }

            ViewBag.EmployeeList  = new SelectList(EmployeeServices.List(db), "Id", "FirstName", externalGrant.Employee);
            ViewBag.GrantTypeList = new SelectList(GrantTypeServices.List(db), "Id", "Name", externalGrant.GrantType);
            return(View(externalGrant));
        }