コード例 #1
0
    public async Task <IActionResult> RescindInvite([FromBody] DeleteInviteRequest request)
    {
        var leagueRecord = await GetExistingLeague(request.LeagueID, RequiredRelationship.LeagueManager);

        if (leagueRecord.FailedResult is not null)
        {
            return(leagueRecord.FailedResult);
        }
        var validResult = leagueRecord.ValidResult !;

        LeagueInvite?invite = await _leagueMemberService.GetInvite(request.InviteID);

        if (invite is null)
        {
            return(BadRequest());
        }

        if (invite.League.LeagueID != validResult.League.LeagueID)
        {
            return(Forbid());
        }

        await _leagueMemberService.DeleteInvite(invite);

        return(Ok());
    }