Ejemplo n.º 1
0
        public async Task<IActionResult> Create([FromBody] CreateIncoming value)
        {
            var response = await Mediator.Send(value);

            if (response.Success)
                return StatusCode(200, response);

            return StatusCode(500, response);

        }
Ejemplo n.º 2
0
        public async Task <ActionResult <string> > CreateIncoming(CreateIncoming createIncoming)
        {
            var connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113));
            await connection.ConnectAsync();

            var aggregateRepository   = new AggregateRepository(connection);
            var commandHandlers       = new CommandHandlers(aggregateRepository);
            var dispatcher            = new Dispatcher(commandHandlers);
            var createIncomingCommand = new CreateIncoming(Guid.NewGuid(), createIncoming.Category, createIncoming.Amount, createIncoming.Comment, DateTime.Now);
            await dispatcher.Dispatch(createIncomingCommand);

            return("command issued / event created");
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([FromBody] CreateIncoming value)
        {
            var result = await Mediator.Send(value);

            return(StatusCode(result.StatusCode, result));
        }