public async Task <AggregateContestSolutionsResult> HandleAsync(AggregateContestSolutionsQuery query) { var solutions = await GetSolutions(query.ContestId); var aggregate = new ContestSolutionAggregate(); foreach (var solution in solutions) { var userId = solution.IdentityUser.Id; var userName = solution.IdentityUser.UserName; if (!aggregate.Users.ContainsKey(userId)) { aggregate.Users[userId] = new UserSolutionAggregate(userName); } var task = solution.Task; aggregate.Users[userId].Tasks.Add(new TaskDto(task.Id, task.Name)); } return(new AggregateContestSolutionsResult(aggregate)); }
public AggregateContestSolutionsResult(ContestSolutionAggregate aggregate) { Aggregate = aggregate; }