public ActionResult Create(JobOffer joboffer) { if (ModelState.IsValid) { joboffer.adminID = 1; User admin = db.Users.Find(1); joboffer.admin = admin; db.Jobs.Add(joboffer); db.SaveChanges(); return RedirectToAction("Index"); } return View(joboffer); }
public ActionResult Edit(int id, JobOffer job) { JobOffer _job = db.Jobs.Find(id); if (ModelState.IsValid) { _job.poste = job.poste; _job.place = job.place; _job.activity = job.activity; _job.dateOffre = job.dateOffre; _job.level = job.level; _job.experience = job.experience; _job.profile = job.profile; _job.missions = job.missions; _job.atouts = job.atouts; db.SaveChanges(); return RedirectToAction("Index"); } return View(job); }