public ActionResult Create(Job job) { job.DatePosted = DateTime.Now; if (ModelState.IsValid) { db.Jobs.Add(job); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.EmployerID = new SelectList(db.Employers, "ID", "CompanyName", job.EmployerID); ViewBag.PositionType = SelectPosition(); return View(job); }
public ActionResult Edit(Job job) { //job.DatePosted = DateTime.Now; if (ModelState.IsValid) { db.Entry(job).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.EmployerID = new SelectList(db.Employers, "ID", "CompanyName", job.EmployerID); ViewBag.PositionType = SelectPosition(); return View(job); }