public void AddProduct(Product product) { using (VenusKuaforContext context = new VenusKuaforContext()) { context.Products.Add(product); context.SaveChanges(); } }
public List <Product> GetAllProducts() { VenusKuaforContext contextcon = new VenusKuaforContext(); if ((contextcon.Database.Connection.State & ConnectionState.Open) != 0) { MessageBox.Show("bağlantı is ok"); } else { MessageBox.Show("bağlantı is YOK"); } ; using (VenusKuaforContext context = new VenusKuaforContext()) { return(context.Products.ToList()); } }