public void CreateProduct(Product product)
 {
     using (var db = new OskarEntities())
     {
         db.Products.Add(product);
         db.SaveChanges();
     }
 }
 public void UpdateProduct(Product product)
 {
     using (var db = new OskarEntities())
     {
         db.Products.Attach(product);
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
 public void DeleteProduct(int productId)
 {
     using (var db = new OskarEntities())
     {
         var product = new Product { ProductId = productId };
         db.Products.Attach(product);
         db.Products.Remove(product);
         db.SaveChanges();
     }
 }