Esempio n. 1
0
        //get all cars
        public IEnumerable <CarViewModel> GetAllCars()
        {
            IEnumerable <DBCarRent.Car> cars;

            using (CarsRepository carsRepository = new CarsRepository())
            {
                cars = carsRepository.GetAllCars();
            }
            List <CarViewModel> carsVM = new List <CarViewModel>();

            foreach (DBCarRent.Car car in cars)
            {
                carsVM.Add(MapModelToViewModel(car));
            }
            return(carsVM);
        }