Ejemplo n.º 1
0
 public void DisplayCountries()
 {
     richTextBox1.Text = "";
     db = new modelEntities();
     List<Country> list = db.Countries.ToList();
     foreach (var thing in list)
     {
         richTextBox1.Text += "Code: " + thing.Code + "\r\n";
         richTextBox1.Text += "Name: " + thing.Name + "\r\n";
         richTextBox1.Text += "Continent: " + thing.Continent + "\r\n";
         if (thing.SurfaceArea == null)
         {
             richTextBox1.Text += "Surface Area: N/A \r\n";
         }
         else
         {
             richTextBox1.Text += "Surface Area: " + thing.SurfaceArea + "\r\n";
         }
         if (thing.Population == null)
         {
             richTextBox1.Text += "Population: N/A \r\n";
         }
         else
         {
             richTextBox1.Text += "Population: " + thing.Population + "\r\n";
         }
         if (thing.LifeExpectancy == null)
         {
             richTextBox1.Text += "Life Expectancy: N/A \r\n";
         }
         else
         {
             richTextBox1.Text += "Life Expectancy: " + thing.LifeExpectancy + "\r\n";
         }
         if (thing.GNP == null)
         {
             richTextBox1.Text += "GNP: N/A \r\n";
         }
         else
         {
             richTextBox1.Text += "GNP: " + thing.GNP + "\r\n";
         }
         if (thing.HeadOfState == null)
         {
             richTextBox1.Text += "Head of State: N/A \r\n";
         }
         else
         {
             richTextBox1.Text += "Head of State: " + thing.HeadOfState + "\r\n";
         }
         richTextBox1.Text += "-------------------------------------------------------------------------------------------------------------------------------------------------------------------";
         if (thing.ID != list[list.Count - 1].ID)
         {
             richTextBox1.Text += "\r\n";
         }
     }
 }