/// <summary>
 /// 添加回答
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ActionResult AddAnswer(Answer model)
 {
     var temp = ans.Add(model);
     return Json(temp, JsonRequestBehavior.AllowGet);
 }
        public ActionResult GetQuestionByPage(int? module = null, string parenttype = null, string childtype = null, int page = 1)
        {
            int pagenumber = 6;//每页6条
            IEnumerable<Question> list = qs.FindModelList().ToList();

            //if (module != null)
            //{
            //    list = list.Where(o => o.typeid == module);
            //}

            if (parenttype != null)
            {
                int manid = 1;//Common.CommonClass.GetPartyIdCount();
                switch (parenttype)
                {
                    case "allquestion"://所有收藏
                        list = qs.FindModelList();
                        break;
                    case "myquestion":
                        list = list.Where(o => o.regmanid == manid);
                        break;
                    case "collect":
                        list = cs.FindModelList(o => o.personid == manid).GroupBy(o => o.question).Select(o => o.Key);
                        break;
                }

            }
            if (childtype != null && parenttype != "collect")
            {
                switch (childtype)
                {
                    case "all":
                        break;
                    case "resolved"://已解决
                        list = list.Where(o => o.state == "0");
                        break;
                    case "unsolved"://未解决
                        list = list.Where(o => o.state == "1");
                        break;

                }
            }
            list = list.Skip((page - 1) * pagenumber).Take(pagenumber).ToList();
            var templist = new List<QuestionPageModel>();
            foreach (var i in list)
            {
                i.Type.questions.Clear();
                i.Type.improvereports.Clear();
                var answer = new Answer();
                if (i.Answers.Count!=0)
                {
                    answer = i.Answers.ToList().FirstOrDefault();
                    answer.question = null;
                }
                templist.Add(new QuestionPageModel()
                {
                    ishot=i.ishot,
                    Id=i.Id,
                    state=i.state,
                    regdate=i.regdate,
                    regman=i.regman,
                    regmanid=i.regmanid,
                    title=i.title,
                    Type=i.Type,
                    Answer = answer,
                    content=i.content,
                    typeid=i.typeid
                });

            }
            return Json(templist, JsonRequestBehavior.AllowGet);
        }