title: handle multiselect list box values in asp.net core form submit with multiple records
body: <p>In ASP.NET CORE 2.0 , I am creating an Ajax form. Multiple employee can be updated in this form. There is an employee number and a multi-select list box to select reimbursement for an employee.<br />
  Problem is how to handle Reimbursement values because multiple items can be selected from list box. Form will be submitted as key-value pair.In the case of Reimbursement, Key is Reimbursement and values will be multiple. Therefore, how can it be checked what reimbursement was selected for which <code>EmployeeID</code>?</p>
  <pre class="lang-asp prettyprint-override"><code>    @model myweb.NewWOModel
  
      &lt;form id=&quot;frmWODetail&quot; asp-action=&quot;EditMultipleEmployee&quot; asp- controller=&quot;WOData&quot; data-ajax=&quot;true&quot; data-ajax-method=&quot;POST&quot; data-ajax-success=&quot;onSuccess&quot; data-ajax-failure=&quot;onFailed&quot;&gt;
          @Html.AntiForgeryToken()
          &lt;div class=&quot;row&quot;&gt;
              &lt;div class=&quot;col-sm-12&quot;&gt;
              @foreach (var record in Model.MultipleEmployeeModels)
              {
                  &lt;div class=&quot;row&quot;&gt;
                      &lt;div class=&quot;col-sm-6&quot;&gt;
                          &lt;label&gt;WorkOrder No.:&lt;/label&gt;
                          &lt;span&gt;
                              @record.EmployeeNo
                          &lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;col-sm-6&quot;&gt;
                          &lt;input type=&quot;hidden&quot;
                                 name=&quot;EmployeeID&quot;
                                 value=&quot;@record.EmployeeID&quot; /&gt;
                          &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class=&quot;row col-sm-12&quot;&gt;
                      &lt;select name=&quot;Reimbursement&quot;
                              asp-for=&quot;@record.ReimbursementID&quot;
                              asp-items=&quot;@(new SelectList(
                                Model.ReimbursementModels,
                                &quot;ReimbursementID&quot;,
                                &quot;ReimbursementName&quot;)
                              )&quot; 
                              multiple&gt;
                      &lt;/select&gt;
                  &lt;/div&gt;
              }
  
              &lt;div class=&quot;row&quot;&gt;
                  &lt;div class=&quot;col-sm-12 text-right&quot;&gt;
                      &lt;input type=&quot;submit&quot;
                             class=&quot;btn btn-success&quot;
                             value=&quot;Save&quot;/&gt;          
                      &lt;input type=&quot;button&quot; 
                             class=&quot;btn btn-primary&quot;
                             value=&quot;Close&quot;
                             data- dismiss=&quot;modal&quot; /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  
  
  &lt;script type=&quot;text/javascript&quot;&gt;
      var onComplete = function () {
  
      };
  
      var onSuccess = function (context) {
          
      };
  
      var onFailed = function (context) {
          
      };
  
  &lt;/script&gt;
  </code></pre>
  <p>Controller</p>
  <pre class="lang-cs prettyprint-override"><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;JsonResult&gt; EditMultipleEmployee(EmployeeModel empModel)
  {
      //CODE HERE HOW TO HANDLE LIST BOX VALUES FOR EACH EMP       
  }
  </code></pre>
  <p>Model</p>
  <pre class="lang-cs prettyprint-override"><code>public class EmployeeModel 
  {
      public string[] Reimbursement{get; set;}
      public string[] EmployeeID{get; set;}
  }
  
  public class NewWOModel
  {
      public List&lt;MultipleEmployeeModels&gt; MultipleEmployeeModels{get; set;}
      public List&lt;ReimbursementModel&gt; ReimbursementModels{get; set;}
  }
  
  public class MultipleEmployeeModels
  {
      public string EmployeeNo{get; set;}
      public int EmployeeID{get; set;}
  }
  
  public class ReimbursementModel
  {
      public int ReimbursementID{get; set;}
      public string ReimbursementName{get; set;}
  }
  </code></pre>