public ActionResult AddFunction(AddFunctionModel model, int id = 0)
        {
            if (ModelState.IsValid)
            {
                var r = Manage.AddFunction(model.Name, model.Description, model.Url,
                    Request.Form["Display"].TryTo(0) == 1,
                    model.AllowBlock, id, model.Type, model.SortOrder);

                if (r)
                {
                    return RedirectToAction("Functions", new { type = model.Type });
                }

                TempData["error"] = "添加失败,该功能名已经存在";
            }

            return View(model);
        }
        public ActionResult AddFunction(AddFunctionModel model, int id = 0)
        {
            if (ModelState.IsValid)
            {
                var r = Manage.AddFunction(model.Name, model.Description, model.Url,
                    Request.Form["Display"].TryTo(0) == 1,
                    (model.AllowBlock??"").Split(new[] {"\r\n", "\r"}, StringSplitOptions.RemoveEmptyEntries), id, AccessLevel,
                    model.SortOrder, Token);

                if (r)
                {
                    return RedirectToAction("Functions");
                }

                TempData["error"] = "添加失败,该功能名已经存在";
            }

            return View(model);
        }