/// <summary> /// Victor Algarin /// Created 2017/03/01 /// /// Retrieves the details for a specific vehicle through an id /// </summary> /// <remarks> /// Robert Forbes /// 2017/03/24 /// /// Added repair list access /// </remarks> public Vehicle RetreiveVehicleById(int vehicleId) { Vehicle vehicle = null; try { vehicle = VehicleAccessor.RetreiveVehicleByVehicleId(vehicleId); IRepairManager repairManager = new RepairManager(); vehicle.RepairList = repairManager.RetreiveAllRepairsForVehicle(vehicleId); } catch (Exception) { throw new ApplicationException("There was a problem retreiving the requested vehicle from the database"); } return(vehicle); }
/// <summary> /// Eric Walton /// 2017/02/03 /// Retrieves all vehicles /// </summary> /// <remarks> /// Robert Forbes /// 2017/03/24 /// /// Added repair list access /// </remarks> /// <returns></returns> public List <Vehicle> RetrieveAllVehicles() { var vehicles = new List <Vehicle>(); try { vehicles = VehicleAccessor.RetrieveAllVehicles(); foreach (Vehicle vehicle in vehicles) { IRepairManager repairManager = new RepairManager(); vehicle.RepairList = repairManager.RetreiveAllRepairsForVehicle(vehicle.VehicleID); } } catch (Exception) { throw; } return(vehicles); }