title: Entity Framework isn't saving data to database in WPF
body: <p>I'm developing a POS in WPF. 
  For CRUD operations, I'm using Entity Framework. </p>
  
  <ol>
  <li>Created a WPF View ProductADD
  <a href="http://i.stack.imgur.com/IKvKk.png" rel="nofollow">Product Add View Snap</a></li>
  <li>Created a Class ProductController in Controller Folder</li>
  <li><p>Made object of Entity Framework in ProductController Class <a href="http://i.stack.imgur.com/UmTd8.png" rel="nofollow">ProductController Calss Snap</a></p></li>
  <li><p>Created a method: SaveProduct(Product product) which is taking product object as argument and saving it to database using EF. </p></li>
  <li><p>And From Xaml.Cs I'm calling ProductController Class's Saveproduct method and sending the new product data to it.</p>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
  {
       ProductController pc = new ProductController();
       PRODUCT product = new PRODUCT();
  
       product.PRODUCT_NAME = Product_Name.Text.ToString();
       product.UNITPRICE = Convert.ToInt32(Unit_Price.Text.ToString());
       product.CATEGORY_Id = 1;
       pc.SaveProduct(product);
  
       MessageBox.Show("Product Added Successfully");
  
       this.Close();
  }
  </code></pre></li>
  </ol>
  
  <p>And in ProductController the following code is updating the database</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using PizzaLounge.Models;
  
  namespace PizzaLounge.Controllers 
  {
   public class ProductController 
   {
    PizzaLoungeEntities db = new PizzaLoungeEntities();
    public void SaveProduct(PRODUCT product) 
    {
     db.PRODUCTs.Add(product);
     db.SaveChanges();
    }
   }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <ol start="6">
  <li>The code executes successfully but it doesn't save the product in database. P.S. I have used db.savechanges(). </li>
  </ol>
  
  <p>Am I missing something or using wrong approach to update database? </p>