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)); }
public ActionResult Edit([Bind(Include = "Grant, Amount, Description")] GrantDeduction grantDeduction) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { GrantDeductionServices.Update(CurrentUser.Id, grantDeduction, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed"); 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", grantDeduction.Grant); return(View(grantDeduction)); }
public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.GrantList = new SelectList(GrantServices.List(db), "Product", "Name"); return(View()); }
// GET: GrantDeduction/Edit/5 public ActionResult Edit(Nullable <int> grant) { Db db = new Db(DbServices.ConnectionString); if (grant == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GrantDeduction grantDeduction = GrantDeductionServices.Get(grant.Value, db); if (grantDeduction == null) { return(HttpNotFound()); } ViewBag.GrantList = new SelectList(GrantServices.List(db), "Product", "Name", grantDeduction.Grant); return(View(grantDeduction)); }
// 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)); }