title: asp.net web api with Mysql database
body: <p>I have a background in PHP and bump into a problem while trying out ASP.NET webAPI.</p>
  
  <p>I have a MySQL database and a table that contains some files information.
  Now i want to make a "SELECT * FROM Files" and see the result in XML.</p>
  
  <p>How can i render the result of the query that is returned?</p>
  
  <p>This is my code at the moment,</p>
  
  <p><strong>The Model:</strong></p>
  
  <pre><code>namespace ProductsApp.Models
  {
      public class File
      {
          public int Id {get; set;}
          public string Text {get; set;}
      }
  }
  </code></pre>
  
  <p><strong>The Controller:</strong></p>
  
  <pre><code>public IEnumerable&lt;File&gt; Get()
  {
      try
      {
          command = conn.CreateCommand();
          command.CommandText = "SELECT * FROM Files";
          conn.Open();
  
          MySqlDataReader reader = command.ExecuteReader();
          while (reader.Read())
          {
              //How to output the rows ????
          }
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex.Message);
      }
  
      return null; // return the list
  }
  </code></pre>