public Person(PersonCreateCommand command)
        {
            this.CopyPropertiesFrom(command);

            base.AddEvent(new PersonCreatedDomainEvent
            {
                AggregateRootId = Id,
                CommandJson     = JsonConvert.SerializeObject(command),
                UserId          = command.UserId
            });
        }
Example #2
0
        public async Task <IActionResult> CreateAsync(PersonWriteDto p)
        {
            var command = new PersonCreateCommand
            {
                Person = p
            };

            var response = await _mediator.Send(command);

            return(Ok(response));
        }
Example #3
0
        public async Task <IActionResult> CreateAsync(PersonWriteDto p)
        {
            if (p != null)
            {
                var command = new PersonCreateCommand
                {
                    Person = p
                };
                await _mediator.Send(command);

                Log.Information("Criado com sucesso.");
            }
            Log.Error("Erro: sem objecto");
            return(NoContent());
        }
 public IActionResult Post([FromBody] PersonCreateCommand request)
 {
     _busCommandPublisher.PublishCommandAsync(request);
     return(Created("", null));
 }
Example #5
0
        public async Task <ActionResult> Post(PersonCreateCommand request)
        {
            await _mediator.Publish(request);

            return(Ok());
        }
Example #6
0
 public IActionResult Post([FromBody] PersonCreateCommand command)
 {
     return(Ok(_handlerCreate.Handle(command)));
 }