public void OnToDoListDeleted(ToDoListDeletedV1 @event)
        {
            var toDos = _data.Where(t => t.ToDoListId == @event.AggregateId).ToList();

            foreach (var toDo in toDos)
            {
                _data.Remove(toDo);
            }
        }
Ejemplo n.º 2
0
        public async Task <Unit> Handle(DeleteToDoList request, CancellationToken cancellationToken)
        {
            var toDoList = await _aggregateRepository.LoadAsync(request.ToDoListId);

            var @event = new ToDoListDeletedV1(toDoList.Id);

            toDoList.When(@event);

            await _aggregateRepository.SaveAsync(toDoList);

            return(Unit.Value);
        }
Ejemplo n.º 3
0
        public Task Handle(ToDoListDeletedV1 notification, CancellationToken cancellationToken)
        {
            When(notification);

            return(Task.CompletedTask);
        }