Example #1
0
        private static void CarsManagement()
        {
            ICarCategoriesRepository carCategoriesRepository = new CarCategoriesRepository();
            var firstCarCategory = carCategoriesRepository.GetAllCategories().First();

            ICarsRepository carsRepository = new CarsRepository();

            var firstCarId = carsRepository.InsertCar(new Car
            {
                CategoryId     = firstCarCategory.Id,
                Fuel           = Fuel.Petrol,
                NumberOdSeats  = 5,
                NumberOfWheels = 4
            });

            carsRepository.InsertCar(new Car
            {
                CategoryId     = firstCarCategory.Id,
                Fuel           = Fuel.Petroleum,
                NumberOdSeats  = 2,
                NumberOfWheels = 4,
                EngineDetails  = new EngineDetails
                {
                    EngineSize    = 1800,
                    NumberOfGears = 6
                },
                PartBrands = new Collection <PartBrand>
                {
                    new PartBrand
                    {
                        Name = "Mercedes"
                    },
                    new PartBrand
                    {
                        Name = "BMW"
                    }
                }
            });

            var firstCategory = carCategoriesRepository.GetCategoryById(firstCarCategory.Id);
        }