示例#1
0
    public async Task <IActionResult> GetTeam([FromRoute] Guid teamId)
    {
        try
        {
            var projection = await _teamQueryHandler.GetTeamAsync(teamId);

            return(Ok(TeamResponse.From(projection)));
        }
        catch
        {
            return(NotFound());
        }
    }
    private async Task <bool> Handle(TeamAdded evt)
    {
        var team = await _teamQueryHandler.GetTeamAsync(evt.TeamId);

        var teamObj = new Team(team.Id, team.Name);

        var projection = await _projectionManager.GetProjectionAsync(this.GetPrimaryKey());

        await _projectionManager.UpdateProjection(
            this.GetPrimaryKey(),
            projection with {
            Teams = projection.Teams.Add(teamObj)
        });