public ActionResult Edit(int?id) { int ID = id ?? 0; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0. Response.AppendHeader("Expires", "-1"); // Proxies. if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Answer answer; using (Repos repo = new Repos()) { answer = repo.GetAnswerByID(ID); ViewBag.Pictures = repo.GetViewBagPictureList(answer.AnswerID); } if (answer == null) { return(HttpNotFound()); } ViewBag.ModuleID = new SelectList(db.Modules, "ModuleID", "Name"); return(View(answer)); }
public ActionResult DeleteConfirmed(int id) { Answer answer; using (Repos repo = new Repos()) { answer = repo.GetAnswerByID(id); repo.DeleteAnswer(answer.AnswerID); } return(RedirectToAction("Create", new { id = answer.ModuleID })); }
public ActionResult Create(int?id) { ViewBag.AnswerID = id; Picture picture = new Picture(); int ID = id ?? 0; using (Repos repo = new Repos()) { picture.Answer = repo.GetAnswerByID(ID); } return(View(picture)); }
public ActionResult Delete(int?id) { int ID = id ?? 0; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Answer answer; using (Repos repo = new Repos()) { answer = repo.GetAnswerByID(ID); } if (answer == null) { return(HttpNotFound()); } return(View(answer)); }