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}")); }
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)); }
public async Task <IActionResult> Post([FromBody] CreateUser command) { await _bus.PublishAsync(command); return(Accepted()); }