예제 #1
0
 public static void SeedCarProduct(ICarProductRepository repository)
 {
     repository.AddAsync(new CarProduct()
     {
         CarId = 1, Brand = "Toyota", Series = "Prius", Nickname = "New Prius 2020"
     }).Wait();
     repository.AddAsync(new CarProduct()
     {
         CarId = 2, Brand = "Mercedes benz", Series = "C-Class", Nickname = "C-Class Saloon"
     }).Wait();
     repository.AddAsync(new CarProduct()
     {
         CarId = 3, Brand = "BMW", Series = "i8", Nickname = "i8 Roadster"
     }).Wait();
 }
예제 #2
0
        public async Task <GetCarProductQueryModel> Handle(CreateCarProductCommand request, CancellationToken cancellationToken)
        {
            var product = _mapper.Map <Domain.Entities.CarProduct>(request);
            await _carProductRepository.AddAsync(product);

            return(_mapper.Map <GetCarProductQueryModel>(product));
        }