public object Post([FromBody] EventsBuyingDTO eventsBuyingDTO) { var dtoConfig = AutoMapperConfig.RegisterAllMappings(); var mapper = dtoConfig.CreateMapper(); apiAppService = new ApiAppService(new RabbitMQueue(), mapper, new EventsBuyingManagerService(new EventsBuyingCommandEFCoreRepository( new EventsBuyingContext()))); apiAppService.AddEventsBuying(eventsBuyingDTO); return(eventsBuyingDTO); }
public void TestMethod1() { EventsBuyingDTO events = new EventsBuyingDTO { Id = 1, IdEvento = 2, Nome = "Ale", NomeEvento = "Show Ivete" }; var dtoConfig = AutoMapperConfig.RegisterAllMappings(); var mapper = dtoConfig.CreateMapper(); var apiAppService = new ApiAppService(new RabbitMQueue(), mapper, new EventsBuyingManagerService(new EventsBuyingCommandEFCoreRepository( new EventsBuyingContext()))); apiAppService.AddEventsBuying(events); }
//Commands public void AddEventsBuying(EventsBuyingDTO eventsBuyingDTO) { var command = _mapper.Map <AddEventsBuyingCommands>(eventsBuyingDTO); _queue.Enqueue(command); }