// // GET: /Admin/Opportunities/Create public ActionResult Create() { var grants = _svc.GetAvailableGrants(); var classifications = _svc.GetClassifications(); var vm = new OpportunityBindingModel(new Opportunity(), grants, classifications); return View(vm); }
public ActionResult Create(Opportunity opportunity) { try { // TODO: Add insert logic here if (ModelState.IsValid) _svc.CreateOpportunity(opportunity); return RedirectToAction("Index"); } catch { var grants = _svc.GetAvailableGrants(); var classifications = _svc.GetClassifications(); var vm = new OpportunityBindingModel(opportunity, grants, classifications); return View(vm); } }
public ActionResult Edit(Guid id, Opportunity opportunity) { try { // TODO: Add update logic here if (ModelState.IsValid) _svc.PutOpportunityById(id, opportunity); return RedirectToAction("Index"); } catch { var grants = _svc.GetAvailableGrants(); var classifications = _svc.GetClassifications(); var vm = new OpportunityBindingModel(opportunity, grants, classifications); return View(vm); } }
// // GET: /Admin/Opportunities/Edit/5 public ActionResult Edit(Guid id) { var grants = _svc.GetAvailableGrants(); var opportunity = _svc.GetOpportunityById(id); var classifications = _svc.GetClassifications(); var vm = new OpportunityBindingModel(opportunity, grants, classifications); return View(vm); }