public ActionResult Create(Question question, int questiontype)
 {
     switch (questiontype)
     {
         case 1:
             question.IsOpinionQuestion = true;
             break;
         case 2:
             question.IsStarQuestion = true;
             break;
         case 3:
             question.IsYesOrNoQuestion = true;
             break;
         case 4:
             question.IsOpenQuestion = true;
             break;
         case 5:
             question.IsOpenNumberQuestion = true;
             break;
         case 6:
             question.IsGradeQuestion = true;
             break;
     }
     if (ModelState.IsValid)
     {
         db.Questions.Add(question);
         db.SaveChanges();
         return RedirectToAction("Index", "Question", new { id = question.SurveyId });
     }
     ViewBag.SurveyId = new SelectList(db.Surveys, "SurveyId", "Title", question.SurveyId);
     return View(question);
 }
 public ActionResult Preview(Question m, int id = 0)
 {
     Question question = db.Questions.Find(id);
     if (question == null)
     {
         return HttpNotFound();
     }
     //System.Diagnostics.Debug.WriteLine(m.ToString());
        return View(question);
 }
 public ActionResult Edit(Question question, int questiontype)
 {
     //System.Diagnostics.Debug.WriteLine(questiontype);
     switch (questiontype)
     {
         case 1:
             question.IsOpinionQuestion = true;
             break;
         case 2:
             question.IsStarQuestion = true;
             break;
         case 3:
             question.IsYesOrNoQuestion = true;
             break;
         case 4:
             question.IsOpenQuestion = true;
             break;
         case 5:
             question.IsOpenNumberQuestion = true;
             break;
         case 6:
             question.IsGradeQuestion = true;
             break;
     }
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index", "Question", new { id = question.SurveyId });
     }
     ViewBag.SurveyId = new SelectList(db.Surveys, "SurveyId", "Title", question.SurveyId);
     return View(question);
 }