public async Task <CDKeySuccessResponse> TestCDKeyValid([FromBody] GetProfileByCDKeyRequest request) { var resp = new CDKeySuccessResponse(); var game = (await gameRepository.Lookup(request.gameLookup)).FirstOrDefault(); if (game == null) { throw new ArgumentException(); } var lookupRequest = new CdKeyLookup(); lookupRequest.Cdkey = request.cdkey; lookupRequest.Gameid = game.Id; var failIfNotFound = await cdkeyRepository.LookupFailItNotFound(lookupRequest); if (failIfNotFound == false) { resp.success = true; return(resp); } var keys = await cdkeyRepository.Lookup(lookupRequest); resp.success = keys.Count() > 0; return(resp); }
public async Task <Profile> GetProfileByCDKey([FromBody] GetProfileByCDKeyRequest request) { var game = (await gameRepository.Lookup(request.gameLookup)).FirstOrDefault(); if (game == null) { throw new ArgumentException(); } var cdkeyLookup = new CdKeyLookup(); cdkeyLookup.Gameid = game.Id; cdkeyLookup.Cdkey = request.cdkey; return(await cdkeyRepository.LookupProfileFromCDKey(cdkeyLookup)); }