Пример #1
0
        public async Task GetAllVehicles(ISuccessOrErrorActionResultPresenter <List <Vehicle>, ErrorDto> presenter)
        {
            const long maxMilleage = 90000;
            var        vehicleList = await _sandileSecurityGateway.GetAllVehicles();

            List <Vehicle> vehicleListNearService = new List <Vehicle>();

            foreach (var vehicle in vehicleList)
            {
                if (vehicle.CurrentMilleage > maxMilleage || (maxMilleage - vehicle.CurrentMilleage < 5000))
                {
                    vehicleListNearService.Add(vehicle);
                }
            }

            if (vehicleListNearService.Count > 0)
            {
                presenter.Success(vehicleListNearService);
            }
            else
            {
                presenter.Error(new ErrorDto
                {
                    Message = "No vehicles near service found"
                });
            }
        }
Пример #2
0
        public async Task <List <Vehicle> > GetAllVehiclesNearService()
        {
            const long maxMilleage = 90000;
            var        vehicleList = await _sandileSecurityGateway.GetAllVehicles();

            List <Vehicle> vehicleListNearService = new List <Vehicle>();

            foreach (var vehicle in vehicleList)
            {
                if (!(vehicle.CurrentMilleage > maxMilleage) && ((maxMilleage - vehicle.CurrentMilleage) < 2000))
                {
                    vehicleListNearService.Add(vehicle);
                }
            }

            return(vehicleListNearService);
        }
Пример #3
0
        public async Task GetAllVehicles(ISuccessOrErrorActionResultPresenter <List <Vehicle>, ErrorDto> presenter)
        {
            var vehicles = await _sandileSecurityGateway.GetAllVehicles();

            if (vehicles.Count > 0)
            {
                presenter.Success(vehicles);
            }
            else
            {
                presenter.Error(new ErrorDto
                {
                    Message = "No vehicles found"
                });
            }
        }