public ActionResult CreateProject(int ContactID) { ProjectSpotlight model = new ProjectSpotlight(); model.ProfileID = ContactID; return View(model); }
public ActionResult CreateProject(ProjectSpotlight model) { if (ModelState.IsValid) { db.ProjectSpotlights.Add(model); db.SaveChanges(); } else { return RedirectToAction("Index"); } return RedirectToAction("EditProject", new { ProjectID = model.ProjectSpotlightID }); }
public ActionResult EditProject(ProjectSpotlight model) { if (ModelState.IsValid) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return View(model); } else { return View(model); } ProjectSpotlight refreshModel = db.ProjectSpotlights.FirstOrDefault(r => r.ProjectSpotlightID == model.ProjectSpotlightID); return View("EditProject", refreshModel); }