public ActionResult FuncDel(int id)
        {
            SysFunctionBll bll   = new SysFunctionBll();
            SYS_FUNCTION   model = bll.Query(t => t.FN_ID == id).FirstOrDefault();

            if (model != null)
            {
                bll.Delete(model, true);
            }
            return(Json(BaseModels.OK("成功!")));
        }
        /// <summary>
        /// 菜单
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult FuncEdit(int?Id)
        {
            SysFunctionBll bll   = new SysFunctionBll();
            SYS_FUNCTION   model = new SYS_FUNCTION();

            ViewBag.Parent = bll.Query(t => t.FN_PARENT_ID == -1).ToDictionary(t => t.FN_ID, t => t.FN_NAME);

            if (Id.ToInt() > 0)
            {
                model = bll.Query(t => t.FN_ID == Id).FirstOrDefault();
            }

            return(View(model));
        }
        public ActionResult FuncEdit(SYS_FUNCTION model)
        {
            SysFunctionBll bll = new SysFunctionBll();

            ViewBag.Parent = bll.Query(t => t.FN_PARENT_ID == -1).ToDictionary(t => t.FN_ID, t => t.FN_NAME);

            model.FN_IS_LEAF = 0;
            if (model.FN_ID > 0)
            {
                bll.Update(model);
            }
            else
            {
                bll.Add(model);
            }

            ViewBag.Success = true;
            ViewBag.Message = "修改成功!";

            return(View(model));
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult FuncList()
        {
            string keyword = Request["keyword"];
            int    page    = string.IsNullOrEmpty(Request["page"]) ? 1 : Request["page"].ToInt();
            int    count   = string.IsNullOrEmpty(Request["count"]) ? 10 : Request["count"].ToInt();

            SysFunctionBll      bll     = new SysFunctionBll();
            List <SYS_FUNCTION> allFunc = bll.Query(t => string.IsNullOrEmpty(keyword) ? true : t.FN_NAME.Contains(keyword)).ToList();

            ViewBag.Parent = bll.Query(t => t.FN_PARENT_ID == -1).ToDictionary(t => t.FN_ID, t => t.FN_NAME);


            ViewBag.Total     = allFunc.Count;
            ViewBag.PageIndex = page;
            ViewBag.PageCount = count;
            ViewBag.Keyword   = keyword;
            //分页
            allFunc = allFunc.Take(count * page).Skip(count * (page - 1)).ToList();

            return(View(allFunc));
        }