title: How to pass List<Tuple> from Table to Controller?
body: <p>I have this code in C# using EF Core 1.2 where I have a form containing two submit buttons. The first button 'upload' invokes my method 'UpLoadMyFile' which compares 
  each line from my textarea to a pattern and returns a string which tells me if it matches one pattern.
  Then I add all my text and its states into a </p>
  
  <pre><code> List &lt;Tuple&lt;string, string&gt;&gt; 
  </code></pre>
  
  <p>that I pass to my View via a ViewModel and display each line plus its state in a table.</p>
  
  <p>Now I'm trying to save each line into my database when I click my second button 'save'. But every time I try to save my lines a NullReferenceException occurs 
  which tells me my List from my table is null. </p>
  
  <p>I would like to know how to pass all lines and states from my Table 'MyTupleList' to my Post Method since I really don't know how to fix my problem.</p>
  
  <p>My View:</p>
  
  <pre><code>@model Models.ViewModels.CreateSaetzeModelView
  &lt;form asp-action="ProcessCreateLines" asp-controller="SoftwareService" method="post" enctype="multipart/form-data"&gt;
  
  &lt;div class="div-marginBottom"&gt;        
      &lt;table class="table"&gt;           
          &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;textarea name="ExpressionTextarea" id="ExpressionTextarea" runat="server" TextMode="MultiLine" asp-for="@Model.LoadExpressions"&gt;&lt;/textarea&gt;
  
                      &lt;div class="col-md-10"&gt;
                          &lt;input type="submit" name="upload" value="upload" /&gt; !--Calls 'uploadmyfile' action--&gt;
                      &lt;/div&gt;
                  &lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;br /&gt;
  &lt;div class="div-ExpressionEingabe"&gt;
  
  &lt;/div&gt;
  @if (Model.MyLinesList != null)
  {
      &lt;div class="div-marginBottom"&gt;
          &lt;table id="MyTupleList" class="table table_align"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;
                          State
                      &lt;/th&gt;
                      &lt;th&gt;
                          MyLines
                      &lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;   
  
                      @foreach (var item in Model.MyLinesList)
                  {
                      &lt;tr&gt;
                          &lt;td&gt;                               
                              @Html.DisplayFor(modelItem =&gt; item.Item2)
                          &lt;/td&gt;
                          &lt;td&gt;
                              @Html.DisplayFor(modelItem =&gt; item.Item1)                            
                      &lt;/tr&gt;
                  }
  
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;input type="submit" name="save" value="save" /&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p></p>
  
  <p>My Code:</p>
  
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; ProcessCreateLines(string upload, string save, CreateLinesModelView cmv)
      {           
          //Button 'upload': Checking my lines 
          if (!string.IsNullOrEmpty(upload))
          {
              string expressions = Request.Form["ExpressionTextarea"].ToString();
  
              List&lt;Tuple&lt;string, string&gt;&gt; result = new FileUploadController().CheckExpressions(expressions);
  
              cmv.MyLinesList = result;
  
              return View("ProcessCreateLines", cmv);
  
          }
  
          //Button 'save': Saving my lines into a Database
          if (!string.IsNullOrEmpty(save))
          {
      // ****************************MyLinesList is null*******************
              var list = cmv.MyLinesList;
  
              ...saving my list into database...
              }
  
          }
  </code></pre>