public ActionResult Edit([Bind(Include = "CategoryId,jCategory,Category_desc")] jobcategory jobcategory) { if (ModelState.IsValid) { db.Entry(jobcategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jobcategory)); }
public ActionResult Delete(int CategoryId) { jobcategory jobcategory = db.jobcategories.Find(CategoryId); var jobincatg = db.jobs.Where(jj => jj.Cat_name == jobcategory.jCategory); db.jobs.RemoveRange(jobincatg); db.jobcategories.Remove(jobcategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "CategoryId,jCategory,Category_desc")] jobcategory jobcategory) { if (ModelState.IsValid) { db.jobcategories.Add(jobcategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jobcategory)); }
// GET: jobcategories/Edit/5 public ActionResult Edit(int?CategoryId) { if (CategoryId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } jobcategory jobcategory = db.jobcategories.Find(CategoryId); if (jobcategory == null) { return(HttpNotFound()); } return(View(jobcategory)); }