コード例 #1
0
        public async Task HandleAsync(UserCreated @event)
        {
            var user = new Models.User(@event.Id)
            {
                FirstName = @event.FirstName,
                LastName  = @event.LastName,
                Role      = @event.Role,
                Email     = @event.Email,
                Version   = @event.AggregateVersion
            };

            await db.Users.AddAsync(user);

            await db.SaveChangesAsync();
        }
コード例 #2
0
        public async Task HandleAsync(TaskAssignedToSprint @event)
        {
            var sprint = await sprintRepository.GetAsync(@event.SprintId);

            var task = await taskRepository.GetAsync(@event.IssueId);

            var sqlQuery = $"UPDATE \"project-management-views\".\"Issues\" SET \"SprintId\" = '{@event.SprintId}', \"Version\" = '{@event.AggregateVersion}' WHERE \"project-management-views\".\"Issues\".\"Id\" = '{task.Id}'";
            await db.Database.ExecuteSqlCommandAsync(sqlQuery);

            await db.SaveChangesAsync();

            //sprint.Tasks.Add(task);
            //await sprintRepository.Update(sprint);
            //task.Version = @event.AggregateVersion;
            //await taskRepository.Update(task);
        }
コード例 #3
0
        public async Task HandleAsync(NfrAssignedToSprint @event)
        {
            var sprint = await sprintRepository.GetAsync(@event.SprintId);

            var Nfr = await nfrRepository.GetAsync(@event.IssueId);

            var sqlQuery = $"UPDATE \"project-management-views\".\"Issues\" SET \"SprintId\" = '{@event.SprintId}', \"Version\" = '{@event.AggregateVersion}' WHERE \"project-management-views\".\"Issues\".\"Id\" = '{Nfr.Id}'";
            await db.Database.ExecuteSqlCommandAsync(sqlQuery);

            await db.SaveChangesAsync();
        }
コード例 #4
0
        public async Task HandleAsync(SprintCreated @event)
        {
            var project = await db.Projects.Include(x => x.Sprints).SingleOrDefaultAsync(x => x.Id == @event.ProjectId);

            if (project == null)
            {
                throw new EntityDoesNotExist(@event.ProjectId, nameof(Models.Project));
            }

            var sprint = new Models.Sprint(@event.Id)
            {
                Name    = @event.Name,
                Start   = @event.Start,
                End     = @event.End,
                Status  = @event.Status,
                Version = @event.AggregateVersion
            };

            project.Sprints.Add(sprint);
            await db.SaveChangesAsync();
        }