Esempio n. 1
0
        public Sentence GetSentence(int difficulty)
        {
            connection.Open();
            SqlCommand command = new SqlCommand("SELECT * FROM Lines WHERE difficulty = @difficulty");
            Sentence sentence = new Sentence();

            using (SqlDataReader reader = command.ExecuteReader())
            {
                sentence.SentenceString = reader.GetString(reader.GetOrdinal("sentence_string"));
                sentence.SentenceLength = reader.GetInt32(reader.GetOrdinal("sentence_length"));
            }

            connection.Close();

            sentence.Difficulty = difficulty;
            return sentence;
        }
Esempio n. 2
0
 public GameController()
 {
     _view = new ConsoleView();
     _sentence = new Sentence();
     _sentencedb = new SentenceDB();
 }