public ActionResult IndexExecute(int Key = 0) { if (CanRead) { var roleinfo = new RoleInfo() { Key = Key }; if (Key == 0) { ViewBag.Operation = "添加角色"; return(View(roleinfo)); } else { ViewBag.Operation = "修改角色"; var service = Container.GetService <IRoleService>(); var roledto = service.GetRoleDtoByKey(Key); if (roledto != null) { roleinfo = RoleInfo.ConvertToRoleInfo(roledto); return(View(roleinfo)); } else { ViewBag.Message = "不存在此角色"; return(View("Error")); } } } else { ViewBag.Message = CannotReadText; return(View("Error")); } }