// GET: Menus/Edit/5 public async Task <IActionResult> Edit(int id) { if (id == null) { return(NotFound()); } var menu = await _context.Menu.FindAsync(id); if (menu == null) { return(NotFound()); } MenuViewModel mvm = new MenuViewModel(); BindObject.CopyModel(mvm, menu); mvm.Roles = _rbac.GetMenuRoles(menu); Form form = Form(); form.Model(mvm, "ID"); ViewData["form"] = form.GetContent(); ViewData["script"] = form.GetScript(); return(View()); }