コード例 #1
0
        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));
        }