public IEnumerable <VerteciesIsInGame> Get()
 {
     try
     {
         List <VerteciesIsInGame> verteciesList = new List <VerteciesIsInGame>();
         VerteciesIsInGame        v             = new VerteciesIsInGame();
         verteciesList = v.Read();
         return(verteciesList);
     }
     catch (Exception)
     {
         throw new Exception("בעיה בקריאת הנתונים מהמערכת");
     }
 }
    //---------------------------------------------------------------------------------
    // Read Vertecies from the DB into a list - dataReader withOut Filter
    //---------------------------------------------------------------------------------
    public List <VerteciesIsInGame> GetVertecies(string conString, string tableName)
    {
        SqlConnection            con = null;
        List <VerteciesIsInGame> lv  = new List <VerteciesIsInGame>();

        try
        {
            con = connect(conString); // create a connection to the database using the connection String defined in the web config file

            String     selectSTR = "SELECT * FROM " + tableName;
            SqlCommand cmd       = new SqlCommand(selectSTR, con);

            // get a reader
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); // CommandBehavior.CloseConnection: the connection will be closed after reading has reached the end

            while (dr.Read())
            {   // Read till the end of the data into a row
                VerteciesIsInGame v = new VerteciesIsInGame();
                v.VerteciesId       = (Int32)dr["VerteciesId"];
                v.GameID            = (Int32)dr["GameID"];
                v.VerteciesPosition = (Int32)dr["VerteciesPosition"];

                lv.Add(v);
            }

            return(lv);
        }
        catch (Exception ex)
        {
            // write to log
            throw (ex);
        }
        finally
        {
            if (con != null)
            {
                con.Close();
            }
        }
    }