public Board GetBoard(int boardId) { TilesDAO til = new TilesDAO(); PortDAO port = new PortDAO(); Board returnBoard = new Board(); con.Open(); // where needs to be added string query = "SELECT * FROM Board WHERE Id= @Id"; using (SqlCommand command = new SqlCommand(query, con)) { command.Parameters.Add(new SqlParameter("@Id", boardId)); //command.Parameters["Id"].Value = boardId; command.ExecuteNonQuery(); SqlDataReader read = command.ExecuteReader(); while (read.Read()) { read.GetInt32(0); read.GetInt32(1); } con.Close(); returnBoard.Tiles = til.GetAllTilesFromBoard(boardId); returnBoard.Ports = port.GetAllPortsFromBoard(boardId); return(returnBoard); //daarna ga naar tiles en port en haal alle gegevens op } }
public BoardDAO() { port = new PortDAO(); tile = new TilesDAO(); }