public void Delete(Product entity) { using (var _context = new MAppDataContext()) { var deleteEntity = _context.Entry(entity); deleteEntity.State = EntityState.Deleted; _context.SaveChanges(); } }
public void Update(Product entity) { using (var _context = new MAppDataContext()) { var updatedEntity = _context.Entry(entity); updatedEntity.State = EntityState.Modified; _context.SaveChanges(); } }
public void Add(Product entity) { using (var _context = new MAppDataContext()) { var addEntity = _context.Entry(entity); addEntity.State = EntityState.Added; _context.SaveChanges(); } }