public async Task <IActionResult> FetchInvitationsAsync([FromQuery] ClanId?clanId = null, [FromQuery] UserId?userId = null) { if (clanId == null && userId == null) { return(this.BadRequest("No query parameter as been provided.")); } if (clanId != null && userId != null) { return(this.BadRequest("Only one query parameter must be provided.")); } var invitations = new List <Invitation>(); if (clanId != null) { invitations.AddRange(await _invitationService.FetchInvitationsAsync(clanId)); } if (userId != null) { invitations.AddRange(await _invitationService.FetchInvitationsAsync(userId)); } if (!invitations.Any()) { return(this.NoContent()); } return(this.Ok(_mapper.Map <IEnumerable <InvitationDto> >(invitations))); }