public async Task <IActionResult> Details(int id)
        {
            return(await _resiliencyHelper.ExecuteResilient(async() =>
            {
                var insurance = await _vehicleManagementAPI.GeInsuranceById(id);
                var vehicle = await _vehicleManagementAPI.GetVehicleByCode(insurance.VehicleId.ToString());
                var vehicles = await _vehicleManagementAPI.GetVehicles();

                var model = new VehicleInsuranceManagementDetailsViewModel
                {
                    Insurance = insurance,
                    Vehicle = vehicle,
                    Vehicles = vehicles.Select(c => new SelectListItem {
                        Value = c.Codigo.ToString(), Text = c.Matricula
                    })
                };
                return View(model);
            }, View("Offline", new VehicleInsuranceManagementOfflineViewModel())));
        }
Exemple #2
0
 public async Task <IActionResult> Index()
 {
     return(await ExecuteWithFallback(async() =>
     {
         var model = new VehicleManagementViewModel
         {
             Vehicles = await _vehicleManagementAPI.GetVehicles()
         };
         return View(model);
     }));
 }
Exemple #3
0
 public async Task <IActionResult> Index()
 {
     return(await _resiliencyHelper.ExecuteResilient(async() =>
     {
         var model = new VehicleManagementViewModel
         {
             Vehicles = await _vehicleManagementAPI.GetVehicles()
         };
         return View(model);
     }, View("Offline", new VehicleManagementOfflineViewModel())));
 }
        public async Task <IActionResult> New()
        {
            return(await _resiliencyHelper.ExecuteResilient(async() =>
            {
                //get vehiclelist
                var vehicles = await _vehicleManagementAPI.GetVehicles();

                var model = new VehicleInsuranceManagementNewViewModel
                {
                    Insurance = new Insurance(),
                    Vehicles = vehicles.Select(c => new SelectListItem {
                        Value = c.Codigo.ToString(), Text = c.Matricula
                    })
                };
                return View(model);
            }, View("Offline", new VehicleInsuranceManagementOfflineViewModel())));
        }
 public async Task <List <Vehicle> > GetVehicles()
 {
     return(await _client.GetVehicles());
 }