public JogoDataSeed() { this.Context = ContextUtility.GetContext(); List <Jogo> Games = new List <Jogo>() { new Jogo("Test Jogo 1", "Aventura", false), new Jogo("Test Jogo 2", "Guerra", false), new Jogo("Test Jogo 3", "Carro", true) }; this.Context.AddRange(Games); this.Context.SaveChanges(); }
/// <summary> /// Returns application/json containing userAccessToken and appOnlyAccessToken properties for a valid clientId and cacheKey combo or a 404 for invalid input. /// </summary> /// <param name="args">An <see cref="GetACSAccessTokensArgs"/> instance specifying the location of the client configuration in Azure storage.</param> /// <returns>JSON or 404</returns> public HttpResponseMessage Execute(GetACSAccessTokensArgs args) { try { var cacheKey = _queryParams["cacheKey"]; var clientId = _queryParams["clientId"]; var clientConfig = GetConfiguration(clientId); var tokens = GetSecurityTokens(cacheKey, clientId); Uri hostUri = new Uri(tokens.AppWebUrl); var userAccessToken = GetUserAccessToken(cacheKey, tokens, hostUri, clientConfig); var appOnlyAccessToken = ContextUtility.GetAppOnlyAccessToken(clientId, cacheKey); _response.StatusCode = HttpStatusCode.OK; _response.Content = new StringContent($"{{\"userAccessToken\":\"{userAccessToken.AccessToken}\", \"appOnlyAccessToken\":\"{appOnlyAccessToken}\"}}"); _response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); } catch { _response.StatusCode = HttpStatusCode.NotFound; } return(_response); }