public async Task <Jogos_View> Consultar_jogo(string Name, double Preco) { var comando = $"select * from jogos where Nome_jogo = '{Name}' and Preco = '{Preco}'"; Jogos_View jogos = null; await SqliteConnection.OpenAsync(); SqliteCommand sqliteCommand = new SqliteCommand(comando, SqliteConnection); SqliteDataReader dt = await sqliteCommand.ExecuteReaderAsync(); while (dt.Read()) { jogos = new Jogos_View { Id = (int)(long)dt["Id"], Nome_jogo = (string)dt["Nome_jogo"], Audio = (string)dt["Audio"], Classificacao = (string)dt["Classificacao"], preco = (double)dt["Preco"] }; } await SqliteConnection.CloseAsync(); return(jogos); }
public async Task <Jogos_View> GetByIdJogos(int id) { Jogos_View jogos = null; var comando = $"select * from jogos where Id = '{id}'"; await SqliteConnection.OpenAsync(); SqliteCommand sqliteCommand = new SqliteCommand(comando, SqliteConnection); SqliteDataReader dt = await sqliteCommand.ExecuteReaderAsync(); while (dt.Read()) { jogos = new Jogos_View { Id = (int)(long)dt["Id"], Nome_jogo = (string)dt["Nome_jogo"], Audio = (string)dt["Audio"], Classificacao = (string)dt["Classificacao"], preco = (double)dt["Preco"] }; } await SqliteConnection.CloseAsync(); return(jogos); }