Exemplo n.º 1
0
 public void Update(Store storeObject)
 {
     using (var db = new CompaniesDBEntities())
     {
         db.Stores.Attach(storeObject);
         db.Entry(storeObject).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Delete(Company companyObject)
 {
     using (var db = new CompaniesDBEntities())
     {
         Company companyItem = db.Companies.Find(companyObject.Id);
         db.Companies.Remove(companyItem);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
        public void Delete(Store storeObject)
        {
            using (var db = new CompaniesDBEntities())
            {
                Store storeItem = db.Stores.Find(storeObject.Id);

                db.Stores.Remove(storeItem);
                db.Entry(storeItem).State = EntityState.Deleted;
                db.SaveChanges();
            }
        }
Exemplo n.º 4
0
 public void Add(Store storeObject)
 {
     using (var db = new CompaniesDBEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             db.Stores.Add(storeObject);
             db.SaveChanges();
             transaction.Commit();
         }
     }
 }