public async Task <ActionResult <ApiResultViewModel <FriendRequest> > > GetFriendRequests( [FromQuery] QueryInputModel <FriendRequestFilterInputModel> filterInputModel, CancellationToken cancellationToken) { var fromAccountId = filterInputModel.FilterParameters.FirstOrDefault(q => q.FieldName == nameof(FriendRequestFilterInputModel.FromAccountId)); var toAccountId = filterInputModel.FilterParameters.FirstOrDefault(q => q.FieldName == nameof(FriendRequestFilterInputModel.ToAccountId)); if ((fromAccountId == null || !string.Equals(fromAccountId.Values[0], AccountId.ToString(), StringComparison.OrdinalIgnoreCase)) && (toAccountId == null || !string.Equals(toAccountId.Values[0], AccountId.ToString(), StringComparison.OrdinalIgnoreCase))) { return(Forbidden()); } var friendRequests = await _friendRequestManager.GetAllAsync(filterInputModel, cancellationToken); return(OkData(friendRequests.Data, friendRequests.TotalCount)); }