Beispiel #1
0
        public async Task <IActionResult> Details(string id)
        {
            return(await _resiliencyHelper.ExecuteResilient(async() =>
            {
                //get vehicle
                Vehicle vehicle = await _vehicleManagementAPI.GetVehicleByCode(id);
                //get ownersList
                var owners = await _vehicleManagementAPI.GetOwners();

                var model = new VehicleManagementDetailsViewModel
                {
                    Vehicle = vehicle,
                    Owners = owners.Select(c => new SelectListItem {
                        Value = c.OwnerId.ToString(), Text = c.RazonSocial
                    })
                };
                return View(model);
            }, View("Offline", new VehicleManagementOfflineViewModel())));
        }
Beispiel #2
0
 public async Task <IActionResult> Index()
 {
     try
     {
         var model = new VehicleOwnerManagementViewModel
         {
             Owners = await _vehicleManagementAPI.GetOwners()
         };
         return(View(model));
     }
     catch (Exception ex)
     {
         return(View("Offline", new VehicleOwnerManagementOfflineViewModel()));
     }
 }
Beispiel #3
0
        public async Task <IActionResult> New()
        {
            //get ownersList
            var owners = await _vehicleManagementAPI.GetOwners();

            var model = new VehicleManagementNewViewModel
            {
                Vehicle = new Vehicle(),
                Owners  = owners.Select(c => new SelectListItem {
                    Value = c.OwnerId.ToString(), Text = c.RazonSocial
                })
            };

            return(View(model));
        }
Beispiel #4
0
 public async Task <List <Owner> > GetOwners()
 {
     return(await _client.GetOwners());
 }