public Vehicle Create(CreateVehicleModel model)
        {
            var brand = _databaseService.Brands.Find(model.BrandId);


            var vehicle = _factory.Create(model.RegistrationNumber, brand, model.RegistrationDate);


            _databaseService.Vehicles.Add(vehicle);

            _databaseService.Save();

            return(vehicle);
        }
        public async Task CreateAsync(CreateCarDto createCarDto)
        {
            var createCarCommand = new CreateCarCommand(createCarDto.Make,
                                                        createCarDto.Model,
                                                        createCarDto.Engine,
                                                        createCarDto.Doors,
                                                        createCarDto.Wheels,
                                                        createCarDto.BodyType);

            Car car = _factory.Create(createCarCommand);

            await _carRepository.AddAsync(car);

            await _context.SaveChangesAsync();
        }
Esempio n. 3
0
 public override IVehicle Create()
 {
     return(_factory.Create(_requirements));
 }