public ActionResult CommonQuesDetail(int id)
        {
            CommonQuesContext commonQuesContext = new CommonQuesContext();
            CommonQues        singleCommonQues  = commonQuesContext.commonQuesLists.Find(id);

            return(View(singleCommonQues));
        }
Esempio n. 2
0
        public ActionResult Delete(int id)
        {
            CommonQues c = commonQuesContext.commonQuesLists.Find(id);

            commonQuesContext.commonQuesLists.Remove(c);
            commonQuesContext.SaveChanges();
            return(Content("删除成功"));
        }
Esempio n. 3
0
        public ActionResult DeleteMore()
        {
            CommonQues c    = null;
            String     data = Request.Form["CommonQuize"];

            String[] ids = data.Split(',');
            for (int i = 0; i < ids.Length; i++)
            {
                c = commonQuesContext.commonQuesLists.Find(int.Parse(ids[i]));
                commonQuesContext.commonQuesLists.Remove(c);
                commonQuesContext.SaveChanges();
            }
            return(Content("删除成功"));
        }
Esempio n. 4
0
        public ActionResult PublishNews()
        {
            CommonQues c = new CommonQues();

            c.question_content      = Request.Form["question"];
            c.question_release_time = DateTime.Now;

            String text = Request.Form["text"];

            text = text.Replace("#lt;", "<");
            text = text.Replace("#gt;", ">");
            c.question_answer = text;

            if (ModelState.IsValid)
            {
                commonQuesContext.commonQuesLists.Add(c);
                commonQuesContext.SaveChanges();
            }
            return(Content("发布成功"));
        }
Esempio n. 5
0
        public ActionResult Modify()
        {
            CommonQues c = new CommonQues();

            c.question_content      = Request.Form["question"];
            c.question_release_time = DateTime.Now;
            c.question_id           = int.Parse(Request.Form["id"]);

            String text = Request.Form["text"];

            text = text.Replace("#lt;", "<");
            text = text.Replace("#gt;", ">");
            c.question_answer = text;

            if (ModelState.IsValid)
            {
                commonQuesContext.Entry(c).State = EntityState.Modified;
                commonQuesContext.SaveChanges();
            }
            return(Content("修改成功"));
        }
Esempio n. 6
0
        public ActionResult ModifyPage(int id)
        {
            CommonQues c = commonQuesContext.commonQuesLists.Find(id);

            return(View(c));
        }