public async Task <ActionResult> CreateAgendaTrackAsync(Guid conferenceId, CreateAgendaTrack command) { await _commandDispatcher.SendAsync(command.Bind(x => x.ConferenceId, conferenceId)); AddResourceIdHeader(command.Id); return(NoContent()); }
public async Task <ActionResult> CreateAsync(CreateSubmission command) { await _commandDispatcher.SendAsync(command); AddResourceIdHeader(command.Id); return(CreatedAtAction("Get", new { id = command.Id }, null)); }
public async Task <IActionResult> SendMessage(SendMessageApiRequest request) { var command = new SendMessageCommand(Guid.NewGuid(), request.ConversationId, User.GetUserId(), request.Text); await _commandDispatcher.SendAsync(command); var result = await _queryDispatcher.QueryAsync(new GetMessageQuery(command.MessageId)); return(Ok(result)); }
public async Task <int> CreateAsync([FromBody] ChangeProductDto dto) { var command = new CreateProductCommand { Dto = dto }; await _commandDispatcher.SendAsync(command); return(command.Id); }
public async Task <ActionResult> Post(CreateOrder command) { await _commandDispatcher.SendAsync(command); return(Ok()); //return CreatedAtAction(nameof(Get), new {orderId = command.OrderId}, null); }
public async Task <IActionResult> AddLinkedServices(AddLinkedService command) { var id = int.Parse(HttpContext.User.Claims.First(cl => cl.Type == "sub").Value); var context = new BaseContext(0, id, null, null); await commandDispatcher.SendAsync(command, context); return(Accepted()); }
public async Task <ActionResult> Post(SendStory command) { await _commandDispatcher.SendAsync(command); var storyId = _storyRequestStorage.GetStoryId(command.Id); return(Created($"stories/{storyId}", null)); }
public async Task <IActionResult> CancelOrderAsync( [FromBody] CancelOrderCommand command, CancellationToken cancellationToken = default) { var commandResult = await _commandDispatcher.SendAsync <CancelOrderCommand, CancelOrderCommandResult>(command, cancellationToken); return(Ok(commandResult)); }
public Task CreateItemAsync(ItemPostDto command) { var createItemCommand = _itemCommandFactory.CreateInstance(); createItemCommand.Description = command.Description; createItemCommand.Upc = command.Upc; return(_dispatcher.SendAsync(createItemCommand)); }
private async Task PublishCommandsAsync(Saga saga) { var messages = saga.GetUndispatchedCommands().Select(command => { dynamic typeAwareCommand = command; //this cast is required to pass the correct Type to the Notify Method. Otherwise IEvent is used as the Type return((Task)_commandDispatcher.SendAsync(typeAwareCommand)); }); await Task.WhenAll(messages); saga.ClearUndispatchedCommands(); }
protected async Task SendAsync <T>(T command) where T : ICommand { if (command is IAuthenticatedCommand authenticatedCommand) { if (User?.Identity?.IsAuthenticated == true) { authenticatedCommand.UserId = Guid.Parse(User.Identity.Name); } } await _commandDispatcher.SendAsync(command); }
public async Task HandleAsync(DeleteAllProductsCommand request) { using (var transaction = _dbContext.BeginTransaction()) { foreach (var id in request.Dto.Ids) { await _commandDispatcher.SendAsync(new DeleteProductCommand { Id = id }); } await transaction.CommitAsync(); } }
public async Task <IActionResult> CreateNotification(CreateNotificationCommand cmd) { var notificationId = await _commandDispatcher.SendAsync(cmd); return(Created($"notifications/{notificationId}", notificationId)); }
public async Task <ActionResult> FillAttendance(FillAttendanceCommand command) { await _commandDispatcher.SendAsync <FillAttendanceCommand>(command); return(Ok()); }
public async Task <IActionResult> SignUp([FromBody] SignUp command) { await _commandDispatcher.SendAsync(command); return(Ok()); }
public async Task <ActionResult> CreateGroup(CreateGroupCommand command) { await _commandDispatcher.SendAsync <CreateGroupCommand>(command); return(Ok()); }
public Task SendAsync <T>(T command) where T : class, ICommand => _commandDispatcher.SendAsync(command);
public async Task <IActionResult> PostAsync(CreateEmployeeCommand cmd) { await _commandDispatcher.SendAsync(cmd); return(Ok()); }
public async Task SendAsync <TCommand>(TCommand command) where TCommand : ICommand => await _commandDispatcher.SendAsync(command);
public async Task <IActionResult> AddBookAsync() { await _commandDispatcher.SendAsync(new AddBookCommand("master of war", "Tom Ridle")); return(new OkResult()); }
public async Task <ActionResult> Post(CreateOrder command) { await _commandDispatcher.SendAsync(command); return(Created($"orders/{command.OrderId}", null)); }
public async Task <ActionResult> AssignToGroup(AssignToGroupCommand command) { await _commandDispatcher.SendAsync <AssignToGroupCommand>(command); return(Ok()); }
public async Task <IActionResult> AddCategory(AddCategoryCommand cmd) { var result = await _commandDispatcher.SendAsync(cmd); return(Created($"/expenses/{result:N}", result)); }
public async Task HandleAsync(FriendshipCreatedIntegrationEvent @event) { await _commandDispatcher.SendAsync(new CreateConversationCommand(@event.FriendshipId, @event.FirstPerson, @event.SecondPerson)); }
public async Task <ActionResult> CreateAsync(CreateSubmission submission) { await _commandDispatcher.SendAsync(submission); return(CreatedAtAction(nameof(GetAsync).ToString(), new { })); }
public IActionResult Post([FromBody] CreateAnimalCommand command) { _commandDispatcher.SendAsync(command); return(Ok()); }
/// <summary> /// Dispatches a command expecting a result /// </summary> public async Task <TResult> SendAsync <TResult>(ICommand <TResult> command) => await _commandDispatcher.SendAsync(command);
public async Task <ActionResult> AttendAsync(Guid eventId) { await _commandDispatcher.SendAsync(new AttendEvent(eventId, _context.Identity.Id)); return(NoContent()); }
public async Task <ActionResult> Post(RateStory command) { await _commandDispatcher.SendAsync(command); return(NoContent()); }
public async Task HandleAsync(FriendshipRemovedIntegrationEvent @event) { await _commandDispatcher.SendAsync(new RemoveConversationCommand(@event.FriendshipId)); }