Example #1
0
        public async Task <IActionResult> Get()
        {
            Logger.Info("Fetching drivers.");
            var drivers = await _driverService.BrowseAsync();

            return(Json(drivers));
        }
Example #2
0
        public async Task <IActionResult> Get( )
        {
            _logger.Info("Fetch drivers");
            //BrowseAsync returns each driver
            var driver = await _driverservice.BrowseAsync();

            return(Json(driver));
        }
        public async Task SeedAsync()
        {
            var users = await _userService.BrowseAsync();

            var drivers = await _driverService.BrowseAsync();

            if (users.Any() && drivers.Any())
            {
                _webRequestService.CreateUrl(" Baczynskiego  12c", "Gdansk", "80-410");
                //_webRequestService.CleanStree("  Test  owo ","spa cj  a  ");
                return;
            }
            _logger.LogInformation("Initializing data...");
            for (var i = 1; i <= 10; i++)
            {
                var userId   = Guid.NewGuid();
                var username = $"user{i}";
                await _userService.RegisterAsync(userId, $"{username}@test.com",
                                                 username, "secret1234", "user");

                _logger.LogInformation($"Created a new user: '******'.");
                await _driverService.CreateAsync(userId);

                await _driverService.SetVehicle(userId, "BMW", "i8");

                _logger.LogInformation($"Adding a new driver for: '{username}'.");
                await _driverRouteService.AddAsync(userId, "Default route", 1, 1, 2, 2);

                await _driverRouteService.AddAsync(userId, "Job route", 3, 4, 7, 8);

                _logger.LogInformation($"Adding route for: '{username}'.");
            }

            for (var i = 1; i <= 3; i++)
            {
                var userId   = Guid.NewGuid();
                var username = $"userPassenger{i}";
                await _userService.RegisterAsync(userId, $"{username}@test.com",
                                                 username, "secret1234", "user");

                _logger.LogInformation($"Created a new user: '******'.");
                await _passengerService.CreateAsync(userId);

                _logger.LogInformation($"Adding a new passenger for: '{username}'.");
            }

            for (var i = 1; i <= 3; i++)
            {
                var userId   = Guid.NewGuid();
                var username = $"admin{i}";
                _logger.LogInformation($"Created a new admin: '{username}'.");
                await _userService.RegisterAsync(userId, $"{username}@test.com",
                                                 username, "secret1234", "admin");
            }
            _logger.LogInformation("Data was Initialized.");
        }
Example #4
0
        public async Task <IActionResult> GetAsync()
        {
            IEnumerable <DriverDto> drivers = await driverService.BrowseAsync();

            if (drivers == null)
            {
                return(NotFound());
            }
            return(Json(drivers));
        }
Example #5
0
        public async Task <IActionResult> Get()
        {
            var drivers = await _driverService.BrowseAsync();

            if (drivers == null)
            {
                return(NotFound());
            }
            return(Json(drivers));
        }
Example #6
0
        public async Task <IActionResult> Get()
        {
            var drivers = await _driverService.BrowseAsync();

            return(Json(drivers));
        }