public ActionResult DeleteConfirmed(int id) { SurveyOccation surveyOccation = db.SurveyOccations.Find(id); db.SurveyOccations.Remove(surveyOccation); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,StartDate,EndDate,SurveyId")] SurveyOccation surveyOccation) { if (ModelState.IsValid) { db.Entry(surveyOccation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SurveyId = new SelectList(db.Surveys, "Id", "Name", surveyOccation.SurveyId); return(View(surveyOccation)); }
// GET: SurveyOccations/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SurveyOccation surveyOccation = db.SurveyOccations.Find(id); if (surveyOccation == null) { return(HttpNotFound()); } return(View(surveyOccation)); }
// GET: SurveyOccations/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SurveyOccation surveyOccation = db.SurveyOccations.Find(id); if (surveyOccation == null) { return(HttpNotFound()); } ViewBag.SurveyId = new SelectList(db.Surveys, "Id", "Name", surveyOccation.SurveyId); return(View(surveyOccation)); }
// GET: SurveyOccations/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SurveyOccation surveyOccation = db.SurveyOccations.Find(id); var questions = db.Questions.Where(sq => sq.SurveyOccation.Id == id); if (surveyOccation != null) { surveyOccation.Questionses = questions; } if (surveyOccation == null) { return(HttpNotFound()); } return(View(surveyOccation)); }