public IActionResult MigrateMenuItem(int id, int?parentId, MigrateMenuItemViewModel model) { if (parentId == null) { parentId = 0; } var menuItem = _menuAppService.GetMenuItemById(id); if (menuItem != null) { var parentMenuItem = parentId == 0 ? null : _menuAppService.GetMenuItemById((int)parentId); if (menuItem.ParentId == parentId) { return(Json(new JsonResultEntity() { Message = $"{parentMenuItem?.Header ?? "根"}菜单下已包含子菜单{menuItem.Header},无需迁移!", IsSuccessed = false })); } model = new MigrateMenuItemViewModel() { Id = menuItem.Id, ParentId = (int)parentId, Header = menuItem.Header, ParentHeader = parentMenuItem?.Header, }; return(PartialView("_Migrate", model)); } else { throw new JMBasicException("菜单不存在!", HttpStatusCode.BadRequest); } }
public IActionResult MigrateMenuItem(MigrateMenuItemViewModel model) { _menuAppService.MigrateMenuItem(model.Id, model.ParentId); return(Json(new JsonResultEntity() { Message = "迁移成功!" })); }