// GET: Question/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (CheckVisitor()) { // If non-user wants to reach question edit. return(RedirectToAction("NotAuthorized", "Home")); } else if (!CheckAdmin()) { // If normal user wants to reach question edit. return(RedirectToAction("NotAuthorized", "Home")); } Question question = db.Questions.Find(id); if (question == null) { return(HttpNotFound()); } JobController jc = new JobController(); List <SelectListItem> items = jc.CategoryList(); ViewBag.Categories = items; return(View(question)); }
// GET: Question/Create public ActionResult Create() { if (CheckVisitor()) { // If non-user wants to reach question create. return(RedirectToAction("NotAuthorized", "Home")); } else if (!CheckAdmin()) { // If normal user wants to reach question create. return(RedirectToAction("NotAuthorized", "Home")); } JobController jc = new JobController(); List <SelectListItem> items = jc.CategoryList(); ViewBag.Categories = items; return(View()); }