Esempio n. 1
0
        public Task Handle(CreateTaskCommand command)
        {
            var recorded = new TaskRecorded
            {
                Timestamp = DateTimeOffset.UtcNow,
                Title     = command.Title
            };

            _session.Events.Append(command.ProjectId, recorded);
            return(_session.SaveChangesAsync());
        }
Esempio n. 2
0
        public void Apply(TaskRecorded recorded, IEvent e)
        {
            Version = e.Version;
            var task = new ProjectTask
            {
                Title    = recorded.Title,
                Number   = _tasks.Max(x => x.Number) + 1,
                Recorded = recorded.Timestamp
            };

            _tasks.Add(task);
        }