Ejemplo n.º 1
0
        public async Task <Guid> HandleAsync(CreateAssignmentCommand command)
        {
            var assignment = new Assignment {
                Title       = command.Title,
                Description = command.Description,
                PublishAt   = command.PublishAt,
                DeadlineAt  = command.DeadlineAt,
                CourseId    = command.CourseId.GetValueOrDefault(),
            };

            await _repository.Add(assignment);

            await _commandStoreService.PushAsync(command);

            return(assignment.Id);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([FromBody] CreateAssignmentCommand command)
        {
            await Mediator.Send(command);

            return(NoContent());
        }
Ejemplo n.º 3
0
 public async Task CreateAssignment(CreateAssignmentCommand command)
 {
     await _commandBus.PublishAsync(command, CancellationToken.None);
 }