title: How to Select Multiple records & Insert in other table using LINQ to Entity in WPF using C#?
body: <p>I have a <strong>GridControl</strong> which contains the List of items with Checkbox control in it. </p>
  
  <p>I am adding &amp; removing the ID to custom <code>List&lt;int&gt;</code> which contains the checked item column ID value. Now, i wan to loop through the <code>List&lt;int&gt;</code> and select the record from Table and by fetching these checked item want to insert in other table using <strong>Linq</strong> to Entity in <strong>WPF</strong> using <strong>C#</strong>.</p>
  
  <pre><code>List&lt;Infill&gt; infillList = new List&lt;Infill&gt;();
  List&lt;int&gt; infillListIDs=new List&lt;int&gt;();
  private bool ProcessItem(bool IsChecked)
          {
              bool result = false;
              Infill item = grdInfillInner.FocusedRow as Infill;
              if (IsChecked)
              {
  
                  if (item != null)
                  {
                      // DO STUFF HERE EXAMPLE ADD or REMOVE Item to a list, BASED on CHECKED or UNCHECKED!!!
                      int infillid = item.InfillID;
                      infillListIDs.Add(infillid);
                      result = true;
                  }
              }
              else
              { 
                  if(infillListIDs.Contains(item.InfillID))
                  {
                      // if uncheked the checked item then remove from custom list
                      infillListIDs.Remove(item.InfillID);
  
                  }
              }
              grdInfillInner.FocusedRowHandle = -1;
              return result;
          }
  
  private void BtnInsert_Click(object sender, RoutedEventArgs e)
          {
              MessageBox.Show("Total Items :" + infillListIDs.Count);
              //Insert the record in other table (having same table structure)
              //here by selecting from infillListIDs custom list of type List&lt;int&gt; 
  
          }
  private void CheckEdit_Checked(object sender, RoutedEventArgs e)
          {
              e.Handled = ProcessItem(true);
  
          }
  
          private void CheckEdit_Unchecked(object sender, RoutedEventArgs e)
          {
              e.Handled = ProcessItem(false);
          }
  protected void GetAllInfills()
          {
              List&lt;Infill&gt; infillList = new List&lt;Infill&gt;();
              infillList=BLL.GetAllInfills();
              if (infillList != null)
              {
                  grdInfill.ItemsSource = infillList;
                  grdInfill.GroupBy(grdInfill.Columns["Glass.GlassType"], ColumnSortOrder.Ascending);
                  grdInfill.GroupBy(grdInfill.Columns["Glass.Glass_Description"], ColumnSortOrder.Ascending);
                  grdInfill.AutoExpandAllGroups = true;
  
              }
          }
  </code></pre>
  
  <p>I want to fetch the records from <strong>infill</strong> table where <strong>infillListIDs</strong> containing <strong>IDs</strong> of all checked rows from <strong>Infill</strong> table and <code>insert into DummyInfill</code> table having same structure when insert button is clicked!</p>