title: Razor foreach loop and javascript
body: <p>Please help. I am getting a headache with razor. I am trying to use google charts to display my information. </p>
  
  <p>So, this is what I have in my view:</p>
  
  <pre><code>@section scripts
  {
      &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          google.load("visualization", "1", { packages: ["corechart"] });
          google.setOnLoadCallback(drawChart);
          function drawChart() {
              var data = google.visualization.arrayToDataTable([
            ['Date', 'DDM'],
                  @foreach(var item in Model.ToList())
                  {
                      &lt;text&gt;
                          ['item.Item1', 'item.Item2']
                      &lt;/text&gt;
                  }
          ]);
  
              var options = {
                  title: 'Demande de marché',
                  hAxis: { title: 'Date', titleTextStyle: { color: '#333'} }
              };
  
              var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
              chart.draw(data, options);
          }
      &lt;/script&gt;
  }
  </code></pre>
  
  <p>I use the foreach loop to iterate on the model (<code>IEnumerable&lt;Tuple&lt;DateTime,int&gt;&gt;</code>) to add the information in the javascript function. At design time, I get </p>
  
  <pre><code>Conditional compilation is turned off
  </code></pre>
  
  <p>Does anyone know how to solve this?</p>
  
  <p>Thanks</p>
  
  <p>Edit:
  This is the controller:</p>
  
  <pre><code>public ActionResult DDMPerDepartment(string department)
          {
              if (DepartmentsList == null) DepartmentsList = _db.Departments.ToList();
              ViewBag.DepartmentString = DepartmentsList.First().DepartmentName;
  
              IEnumerable&lt;Tuple&lt;DateTime,int&gt;&gt; points = _db.DepartmentNumbers.Where(x =&gt; x.Department.Id == 1).Select(x =&gt; new Tuple&lt;DateTime, int&gt;(x.Date, x.Number));
              return View(points);
          }
  </code></pre>