Exemplo n.º 1
0
        public async Task <IActionResult> RegisterRefuel(RefuelIndexViewModel viewModel)
        {
            var request = new RegisterRefuelRequest()
            {
                DriverCPF           = viewModel.CPF,
                FuelType            = viewModel.FuelType,
                GasStationCNPJ      = viewModel.CNPJ,
                Liters              = viewModel.Liters,
                LiterValue          = viewModel.LiterValue,
                RefuelDate          = viewModel.RefuelDate,
                TotalValue          = viewModel.TotalValue,
                VehicleLicensePlate = viewModel.LicensePlate
            };

            var success = await _movtechAPIService.RegisterRefuel(request);

            if (success)
            {
                ViewBag.RegisterSuccess = "true";
            }

            viewModel.Postos = await GetPostos();

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