public ActionResult ButtonAdd(string menu_id) { menu_id = RQ("menu_id"); InitForm("添加按钮"); if (menu_id.HasValue()) { return(View(ButtonAdd_M.ToViewModel(menu_id))); } else { return(View(new ButtonAdd_M())); } }
public ActionResult ButtonAdd(ButtonAdd_M model) { if (ModelState.IsValid) { model.button_id = model.menu_id + "-" + model.name; if (_button.Find(model.button_id) == null) { _button.Add(model.ToModel()); return(Redirect("/Permission/Admin2/ButtonList?ReportID=Permision.v2_按钮列表&Params=;")); } else { return(Alert("添加失败,请重新添加")); } } else { InitForm("添加按钮"); return(View(model)); } }