Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
        // GET: Driver
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new DriverService(userId);
            var model   = service.GetDrivers();

            return(View(model));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        public async Task <List <Driver> > GetDrivers(int CompanyId)
        {
            IDriverService DriverInfo = new DriverService(CompanyId);

            return(await DriverInfo.GetDrivers());
        }