Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] CreateActivity command)
        {
            command.Id        = Guid.NewGuid();
            command.CreatedAt = DateTime.UtcNow;

            await _bus.PublishAsync(command);

            return(Accepted($"activities/{command.Id}"));
        }
Esempio n. 2
0
        public async Task HandleAsync(CreateActivity command)
        {
            Console.WriteLine($"Creating activity: {command.Name}");

            await _busClient.PublishAsync(
                new ActivityCreated(command.Id,
                                    command.UserId,
                                    command.Category,
                                    command.Name,
                                    command.Description,
                                    DateTime.UtcNow));
        }
Esempio n. 3
0
        public async Task <IActionResult> Post([FromBody] CreateUser command)
        {
            await _bus.PublishAsync(command);

            return(Accepted());
        }