Esempio n. 1
0
 public void Delete(Customer entity)
 {
     var itemToDelete = this.context.Customers.Where(x => x.CustomerID == entity.CustomerID).FirstOrDefault();
     if (itemToDelete != null)
     {
         this.context.Customers.Remove(itemToDelete);
         this.context.SaveChanges();
     }
 }
Esempio n. 2
0
        public void Insert(Customer entity)
        {
            this.context.Customers.Add(entity);
            this.context.SaveChanges();
            disposeCounte++;

            if (disposeCounte % 100 == 0)
            {
                disposeCounte = 0;
                this.context.Dispose();
                this.context = new NorthwindEntities();
            }
        }
Esempio n. 3
0
 public void Update(Customer entity)
 {
     context.Customers.Add(entity);
     context.SaveChanges();
 }