Exemplo n.º 1
0
        //NuGet: Kodların konulup ortak kullanıldığı mekan



        public void Add(Product entity)
        {
            //IDisposable pattern implamentation of c#

            using (NortwindContext context = new NortwindContext())
            {
                var addedEntity = context.Entry(entity);
                addedEntity.State = EntityState.Added;
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
 public Product Insert(Product product)
 {
     _dbContext.Set <Product>().Add(product);
     _dbContext.SaveChanges();
     return(product);
 }
Exemplo n.º 3
0
 public Category Insert(Category category)
 {
     _dbContext.Set <Category>().Add(category);
     _dbContext.SaveChanges();
     return(category);
 }