public ActionResult Delete(int id, FormCollection collection) { try { js.Delete_Job_Template(id); return(RedirectToAction("Index")); } catch { JobTemplates job = js.Get_JobTemplate_By_ID(id); ViewBag.StatusMessage = "WARNING !Cannot delete jobs with current openings"; if (job == null) { return(HttpNotFound()); } return(View(job)); } }