public void Add(Size entity) { using (var db = new BatikStoreEntities()) { db.Sizes.AddObject(entity); db.SaveChanges(); } }
public void Add(Product entity) { using (var db = new BatikStoreEntities()) { db.Products.AddObject(entity); db.SaveChanges(); } }
public void Update(Size entity) { using (var db = new BatikStoreEntities()) { var existing = db.Sizes.SingleOrDefault(c => c.Id == entity.Id); if (existing != null) { db.Sizes.ApplyCurrentValues(entity); db.SaveChanges(); } } }
public void Delete(int id) { using (var db = new BatikStoreEntities()) { var existing = db.Sizes.SingleOrDefault(c => c.Id == id); if (existing != null) { db.Sizes.DeleteObject(existing); db.SaveChanges(); } } }