public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.GrantRequestList = new SelectList(GrantRequestServices.List(db), "Request", "Description"); return(View()); }
public ActionResult Create([Bind(Include = "GrantRequest, AverageIncome, GrantPercentage, ServiceInMonthes")] ServiceEndGrantRequest serviceEndGrantRequest) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { ServiceEndGrantRequestServices.Insert(CurrentUser.Id, serviceEndGrantRequest, 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.GrantRequestList = new SelectList(GrantRequestServices.List(db), "Request", "Description"); return(View(serviceEndGrantRequest)); }
// GET: ServiceEndGrantRequest/Edit/5 public ActionResult Edit(Nullable <int> grantRequest) { Db db = new Db(DbServices.ConnectionString); if (grantRequest == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServiceEndGrantRequest serviceEndGrantRequest = ServiceEndGrantRequestServices.Get(grantRequest.Value, db); if (serviceEndGrantRequest == null) { return(HttpNotFound()); } ViewBag.GrantRequestList = new SelectList(GrantRequestServices.List(db), "Request", "Description", serviceEndGrantRequest.GrantRequest); return(View(serviceEndGrantRequest)); }