public async Task <Vehicle> GetVehicleByCode([AliasAs("id")] string codigo) { try { return(await _client.GetVehicleByCode(codigo)); } catch (ApiException ex) { if (ex.StatusCode == HttpStatusCode.NotFound) { return(null); } else { throw; } } }
public async Task <IActionResult> Details(string id) { return(await _resiliencyHelper.ExecuteResilient(async() => { Vehicle vehicle = await _vehicleManagementAPI.GetVehicleByCode(id); //Customer customer = await _customerManagementAPI.GetCustomerById(vehicle.CustomerId); var model = new VehicleManagementDetailsViewModel { Vehicle = vehicle // CustomerId = customer.Nombre }; return View(model); }, View("Offline", new VehicleManagementOfflineViewModel()))); }
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 model = new VehicleInsuranceManagementDetailsViewModel { Insurance = insurance, Vehicle = vehicle }; return View(model); }, View("Offline", new VehicleInsuranceManagementOfflineViewModel()))); }
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()))); }
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()))); }