Entity Framework - (master detail) how to update Details which on a separate form from Master
<p>I am trying to do this for my project <a href="https://msdn.microsoft.com/en-us/data/jj682076.aspx" rel="nofollow">Entity Framework Databinding with WinForms</a>
but instead of using single form, I'm using 2 forms.</p>

<p><code>CategoryDataGridView</code> is displayed on the <code>Form1</code>, then there is an edit button on <code>Form1</code>, which will load the Form2 which has the <code>ProductsDataGridView</code> (product list of selected category) and a save button to save the changes</p>

<p>I have the following code on my Form2</p>

<pre><code>ProductContext _context = new ProductContext();
public int SeletedCategID { get; set; }

private void Form2_Load(object sender, EventArgs e)
{
    _context.Products.Where(c =&gt; c.CategoryId ==     SeletedCategID).ToList();
    productsBindingSource.DataSource =     (_context.Products.Local).ToList();
}

private void SaveBtn_Click(object sender, EventArgs e)
{
    this.Validate();

    foreach (var product in _context.Products.Local.ToList())
    {
        if (product.Category == null)
        {
            _context.Products.Remove(product);
        }
    }
    this._context.SaveChanges();

    this.productsDataGridView.Refresh();

    Form1 frm1 = (Form1)Application.OpenForms["Form1"];
    frm1.Activate();
    frm1.Refresh();
    this.Dispose();
}
</code></pre>

<p>my problem now is only edits on the products are saved to DB. Add &amp; Delete are not saved to database.</p>