Пример #1
0
        public List <CarInfo> GetCarsByIds(CarRequest request)
        {
            if (request.LicenseKey != "Passcode")
            {
                throw new FaultException("Wrong License Key");
            }

            CarMethods carService = new CarMethods();

            var tempCarList = carService.GetById(request.CarIds);

            var carList = new List <Car>();

            foreach (Domain.Car c in tempCarList)
            {
                carList.Add(new Car
                {
                    Id    = c.Id,
                    Brand = c.Brand,
                    Model = c.Model,
                    Year  = c.Year,
                    RegNr = c.RegNr
                });
            }

            var carListResult = new List <CarInfo>();

            foreach (Car c in carList)
            {
                carListResult.Add(new CarInfo(c));
            }

            return(carListResult);
        }