Пример #1
0
 public ActionResult Create(QuestionModel question)
 {
     try
     {
         if (ModelState.IsValid)
         {
             question.Save();
             return RedirectToAction("Index");
         }
         else
         {
             return View();
         }
     }
     catch
     {
         return View();
     }
 }
Пример #2
0
 private static List<QuestionModel> PopulateQuestions(SqlDataReader reader)
 {
     List<QuestionModel> questionList = new List<QuestionModel>();
     while (reader.Read())
     {
         var question = new QuestionModel
                            {
                                Id = int.Parse(reader["id"].ToString()),
                                Value = reader["value"].ToString()
                            };
         questionList.Add(question);
     }
     return questionList;
 }