public ActionResult Create(Job job) { if (Session["companyID"] != null) { if (ModelState.IsValid) { job.CompId = int.Parse(Session["companyID"].ToString()); db.Jobs.Add(job); db.SaveChanges(); return RedirectToAction("ComJob", "JobReqest"); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", job.CategoryId); ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", job.CountryId); return View(job); } else return RedirectToAction("Login", "Account"); }
public ActionResult Edit(Job job) { if (ModelState.IsValid) { db.Entry(job).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("ComJob", "JobReqest"); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", job.CategoryId); ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", job.CountryId); return View(job); }