public void Handle(TaskDeletedEvent message)
 {
     using (var context = new TaskContext())
     {
         var task = (from t in context.PendingTasks where t.TaskId == message.TaskId select t).SingleOrDefault(); if (task == null)
         {
             return;
         }
         context.PendingTasks.Remove(task); context.SaveChanges();
     }
 }
        public TaskListModel(ITaskRemoteService service, TaskFilter filter, ApplicationGlobalModel applicationGlobalModel,
                             IEventAggregator eventAggregator, [Named("WpfClientMapper")] IMapper mapper)
        {
            this._service                     = service;
            this._taskFilter                  = filter;
            this._eventAggregator             = eventAggregator;
            this.Tasks                        = new ObservableCollection <Task>();
            CreateTask                        = new AwaitableDelegateCommand(OnCreateTask);
            this._taskFilter.PropertyChanged += Filter_PropertyChanged;
            _currentUser                      = applicationGlobalModel.CurrentUser;
            _mapper = mapper;

            TaskDeletedEvent taskDeletedEvent = eventAggregator.GetEvent <TaskDeletedEvent>();

            taskDeletedEvent.Subscribe(OnDeleteTask, ThreadOption.UIThread, false, t => Category != null && t.CategoryId == Category.CategoryId);
        }
Beispiel #3
0
 public void ApplyEvent([AggregateId("TaskId")] TaskDeletedEvent theEvent)
 {
     Deleted = true;
 }
Beispiel #4
0
 public void MarkAsDeleted()
 {
     var deleted = new TaskDeletedEvent(TaskId); RaiseEvent(deleted);
 }
 public async Task HandleTaskDeletedEvent(TaskDeletedEvent taskDeletedEvent)
 {
     // Here you can do whatever you need with this event, you can propagate the data using a queue, calling another API or sending a notification or whatever
     // With this scenario, you are building a event driven architecture with microservices and DDD
 }