コード例 #1
0
        public async Task <IActionResult> CreateAsync(string orderId)
        {
            var viewModel = new ModifyOrderDetailsViewModel {
                OrderId = orderId
            };
            var filledViewModel = await _modifyOrderDetailsViewModelFactory.CreateAsync(viewModel);

            return(View("Create", filledViewModel));
        }
コード例 #2
0
        public async Task <IActionResult> UpdateAsync(ModifyOrderDetailsViewModel modifyOrderDetailsViewModel)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = await _modifyOrderDetailsViewModelFactory.CreateAsync(modifyOrderDetailsViewModel);

                return(View("Update", viewModel));
            }

            var dto = _mapper.Map <OrderDetailsDto>(modifyOrderDetailsViewModel);
            await _orderDetailsService.UpdateAsync(dto);

            return(RedirectToAction("ListAsync", "Order"));
        }
コード例 #3
0
        private static ModifyOrderDetailsViewModel CreateModifyOrderDetailsViewModel()
        {
            var viewModel = new ModifyOrderDetailsViewModel();

            return(viewModel);
        }