示例#1
0
        public IActionResult Register(AirBagDetailViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                MergeToModelStateTransfers(vm);
                TempData.Put(TEMP_AIRBAG_DETAIL_KEY, vm);
                return(RedirectToAction(nameof(Detail)));
            }
            var condition = _mapper.MapToAirBagPutCondition(vm);

            SetPutConditionBase(condition);

            var result = _service.Register(condition);

            if (result.Succeeded)
            {
                vm.AirBagId = result.AirBagId;
                // ポストバック時の排他によるエラー回避のためTempUpdatedAtに登録日時を詰める
                TempLastUpdatedAt = result.LastUpdatedAt;
            }
            SetMessages(vm, result);
            TempData.Put(TEMP_AIRBAG_DETAIL_KEY, vm);
            return(RedirectToAction(nameof(Detail), new { airBagId = vm.AirBagId }));
        } /*Register*/