public void CheckValidity() { if (QueryValidationHelper.IsReservedGuid(CurrentUserId)) { throw new RequestInputException($"Invalid user id '{CurrentUserId}'"); } if (QueryValidationHelper.IsReservedGuid(DeckId)) { throw new RequestInputException($"Invalid deck id '{DeckId}'"); } if (ExcludedCardIds.Any(cardId => QueryValidationHelper.IsReservedGuid(cardId))) { throw new RequestInputException($"Invalid card id"); } if (ExcludedTagIds.Any(cardId => QueryValidationHelper.IsReservedGuid(cardId))) { throw new RequestInputException($"Invalid tag id"); } if (CardsToDownload < 1 || CardsToDownload > 100) { throw new RequestInputException($"Invalid CardsToDownload: {CardsToDownload}"); } }
public async Task CheckValidityAsync(CallContext callContext) { if (QueryValidationHelper.IsReservedGuid(CurrentUserId)) { throw new RequestInputException($"Invalid user id '{CurrentUserId}'"); } if (QueryValidationHelper.IsReservedGuid(DeckId)) { throw new RequestInputException($"Invalid deck id '{DeckId}'"); } if (ExcludedCardIds.Any(cardId => QueryValidationHelper.IsReservedGuid(cardId))) { throw new RequestInputException($"Invalid card id"); } if (ExcludedTagIds.Any(cardId => QueryValidationHelper.IsReservedGuid(cardId))) { throw new RequestInputException($"Invalid tag id"); } if (CardsToDownload < 1 || CardsToDownload > 100) { throw new RequestInputException($"Invalid CardsToDownload: {CardsToDownload}"); } await QueryValidationHelper.CheckUserIsOwnerOfDeckAsync(callContext.DbContext, CurrentUserId, DeckId); }