Exemple #1
0
        /// <summary>
        ///     根据ID删除实体
        /// </summary>
        /// <returns></returns>
        public JsonResult DeleteQuestionSortByID()
        {
            int id = Request.QueryString["id"].StringToInt32();

            if (id > 0)
            {
                int count = 0;
                List <tbQuestion> list = EQuestionBL.GetListByQuery(ref count, id, "", "", int.MaxValue, 1, 0, 0);
                if (list.Count() == 0 && ESortBL.GetAllQuestionSortList().Where(p => p.FatherID == id).Count() == 0)
                {
                    bool result = ESortBL.Delete(id);
                    if (result)
                    {
                        return(Json(new
                        {
                            result = 1,
                            content = "删除成功"
                        }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new
                        {
                            result = 0,
                            content = "删除失败"
                        }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new
                    {
                        result = 0,
                        content = "请先删除本题库下的试题及子题库"
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new
                {
                    result = 0,
                    content = "删除失败"
                }, JsonRequestBehavior.AllowGet));
            }
        }