/// <summary> /// This allows all of the drivers to be retreived /// </summary> /// <returns>This returns all of the drivers</returns> public IHttpActionResult Get() { DriverService driverService = CreateDriverService(); var drivers = driverService.GetDrivers(); return(Ok(drivers)); }
// GET: Driver public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new DriverService(userId); var model = service.GetDrivers(); return(View(model)); }
public void TestMethods() { DriverService driverService = new DriverService(); string selectedYearString = "1950"; string urlDrivers = @"http://ergast.com/api/f1/" + selectedYearString + "/driverstandings.json"; string urlConstructors = @"http://ergast.com/api/f1/" + selectedYearString + "/constructorstandings.json"; driverService.GetDrivers(urlDrivers); driverService.GetConstructors(urlConstructors); }
public void TestGetDrivers() { var options = new DbContextOptionsBuilder <DgtDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new DgtDbContext(options); context.Database.EnsureCreated(); DgtDbInitializer.Initialize(context); DriverRepository driverRepository = new DriverRepository(context); DriverService driverService = new DriverService(driverRepository); var drivers = driverService.GetDrivers(); Assert.True(drivers.Count() == 2); }
private void ButtonShowResults_Click(object sender, RoutedEventArgs e) { string selectedYearString = ComboBoxSelectYear.SelectedItem.ToString(); int.TryParse(selectedYearString, out int selectedYear); if (selectedYear < 1958) { MessageBox.Show("Note: There was no constructors championship until 1958, so no constructors will be shown!"); } string urlDrivers = @"http://ergast.com/api/f1/" + selectedYearString + "/driverstandings.json"; string urlConstructors = @"http://ergast.com/api/f1/" + selectedYearString + "/constructorstandings.json"; driverService.GetDrivers(urlDrivers); driverService.GetConstructors(urlConstructors); viewModel = new ViewModel(); DataContext = viewModel; }
public async Task <List <Driver> > GetDrivers(int CompanyId) { IDriverService DriverInfo = new DriverService(CompanyId); return(await DriverInfo.GetDrivers()); }