public async Task<CommandResult> DeleteMenuAsync(DeleteMenuCommand command) { return await _commandBus.ExecuteAsync(command); }
public async Task<IActionResult> DeleteConfirm(Guid id) { var deleteMenuCommand = new DeleteMenuCommand {Id = id}; var result = await _menuService.DeleteMenuAsync(deleteMenuCommand); if (result.Success) { return RedirectToAction(nameof(Index)); } ModelState.AddCommandErrors(result); var menu = await _menuService.GetMenuByIdAsync(id); if (menu == null) { return NotFound(); } var viewModel = new DeleteMenuViewModel { MenuId = menu.Id, MenuName = menu.Name }; return View(nameof(Delete), viewModel); }