public ActionResult Create([Bind(Include = "Id, GrantPaymentOrder, SubNumber, Grant, Amount, Notes")] GrantPayment grantPayment)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    GrantPaymentServices.Insert(CurrentUser.Id, grantPayment, 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.GrantList             = new SelectList(GrantServices.List(db), "Product", "Name");
            ViewBag.GrantPaymentOrderList = new SelectList(GrantPaymentOrderServices.List(db), "Id", "Notes");
            return(View(grantPayment));
        }
        // GET: GrantPayment/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db           db           = new Db(DbServices.ConnectionString);
            GrantPayment grantPayment = GrantPaymentServices.Get(id.Value, db);

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

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GrantPayment grantPayment = GrantPaymentServices.Get(id.Value, db);

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

            ViewBag.GrantList             = new SelectList(GrantServices.List(db), "Product", "Name", grantPayment.Grant);
            ViewBag.GrantPaymentOrderList = new SelectList(GrantPaymentOrderServices.List(db), "Id", "Notes", grantPayment.GrantPaymentOrder);
            return(View(grantPayment));
        }