Beispiel #1
0
        public async Task <IActionResult> CreateInsurence(InsurenceCreateViewModel viewModel)
        {
            CreateInsurenceRequest request = new CreateInsurenceRequest()
            {
                BeginOfVigency = viewModel.BeginOfVigency,
                EndOfVigency   = viewModel.EndOfVigency,
                BonusClass     = viewModel.BonusClass,
                CINumber       = viewModel.CINumber,
                PolicyNumber   = viewModel.PolicyNumber,
                VehicleId      = viewModel.VehicleId,
                BrokerId       = viewModel.BrokerId,
                InsurerId      = viewModel.InsurerId
            }
            ;

            if (await _movtechAPIService.CreateInsurence(request))
            {
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                ModelState.AddModelError("", "Não foi possível Criar o Seguro ");

                viewModel.Vehicles = await _movtechAPIService.GetAllVeiculos();

                viewModel.Insurers = await _movtechAPIService.GetAllInsurers();

                viewModel.Brokers = await _movtechAPIService.GetAllBrokers();

                return(View("Create", viewModel));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Create()
        {
            var viewModel = new InsurenceCreateViewModel();

            viewModel.Vehicles = await _movtechAPIService.GetAllVeiculos();

            viewModel.Insurers = await _movtechAPIService.GetAllInsurers();

            viewModel.Brokers = await _movtechAPIService.GetAllBrokers();



            return(View(viewModel));
        }