Ejemplo n.º 1
0
 /// <summary>
 /// 显示问题
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult QuestionShow(int id)
 {
     Question question = new Question();
     question = db.Questions.Find(id);
     ViewBag.Question = new vQuestion(question);
     return View();
 }
Ejemplo n.º 2
0
        public ActionResult AddQuestion(Question model)
        {
            var options = Request.Params.GetValues("option");
            string Answers = "";
            for (int i = 0; i < options.Count(); i++)
            {
                if (i == options.Count() - 1)
                {
                    Answers += options[i];
                }
                else
                {
                    Answers += options[i] + "|";
                }
            }

            model.Answers = Answers;
            model.Time = DateTime.Now;
            db.Questions.Add(model);
            db.SaveChanges();
            return Redirect("/Admin/LessionShow/" + model.LessionID);
        }
Ejemplo n.º 3
0
 public ActionResult QuestionDelete(int id)
 {
     Question question = new Question();
     question = db.Questions.Find(id);
     db.Questions.Remove(question);
     db.SaveChanges();
     return Redirect("/Admin/LessionShow/" + question.LessionID);
 }
Ejemplo n.º 4
0
 public ActionResult QuestionDelete(int id)
 {
     Question question = new Question();
     question = db.Questions.Find(id);
     db.Questions.Remove(question);
     db.SaveChanges();
     return Content("ok");
 }