コード例 #1
0
        public async Task GetAllVehiclesNearService(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) < 2000))
                {
                    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 GetAllEmployees(ISuccessOrErrorActionResultPresenter <List <Employee>, ErrorDto> presenter)
        {
            var employees = await _employeeGateway.GetAllEmployees();

            if (employees.Count > 0)
            {
                presenter.Success(employees);
            }
            else
            {
                presenter.Error(new ErrorDto
                {
                    Message = "No employees found"
                });
            }
        }
コード例 #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"
                });
            }
        }