public async Task <IActionResult> Edit(AdminTreeEditViewModel model) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageAdminTree)) { return(Unauthorized()); } var tree = await _adminTreeService.GetByIdAsync(model.Id); if (tree == null) { return(NotFound()); } if (ModelState.IsValid) { tree.Name = model.Name; await _adminTreeService.SaveAsync(tree); _notifier.Success(H["Admin tree updated successfully"]); return(RedirectToAction(nameof(List))); } return(View(model)); }
public async Task <IActionResult> Edit(string id) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageAdminTree)) { return(Unauthorized()); } var tree = await _adminTreeService.GetByIdAsync(id); if (tree == null) { return(NotFound()); } var model = new AdminTreeEditViewModel { Id = tree.Id, Name = tree.Name }; return(View(model)); }