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()))); }
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())); } }
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)); }
public async Task <List <Owner> > GetOwners() { return(await _client.GetOwners()); }