예제 #1
0
파일: MenuService.cs 프로젝트: causer/Itasu
 public async Task<CommandResult> EditMenuAsync(UpdateMenuDetailsCommand command)
 {
     return await _commandBus.ExecuteAsync(command);
 }
예제 #2
0
        public async Task<IActionResult> Edit(EditMenuViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var editMenuCommand = new UpdateMenuDetailsCommand
                {
                    Id = viewModel.Id,
                    Name = viewModel.Name,
                    Title = viewModel.Title
                };

                var result = await _menuService.EditMenuAsync(editMenuCommand);
                if (result.Success)
                {
                    return RedirectToAction(nameof(Index));
                }

                ModelState.AddCommandErrors(result);
            }

            return View(viewModel);
        }