// GET: GrantPaymentOrder/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db db = new Db(DbServices.ConnectionString);
            GrantPaymentOrder grantPaymentOrder = GrantPaymentOrderServices.Get(id.Value, db);

            if (grantPaymentOrder == null)
            {
                return(HttpNotFound());
            }
            return(View(grantPaymentOrder));
        }
        public ActionResult Create([Bind(Include = "Id, Number, Year, Date, Notes")] GrantPaymentOrder grantPaymentOrder)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    GrantPaymentOrderServices.Insert(CurrentUser.Id, grantPaymentOrder, 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;
                }
            }

            return(View(grantPaymentOrder));
        }