public void Edit(Config config) { using (var _context = new EcartContext()) { _context.Entry(config).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } }
public void Update(Product product) { using (var _context = new EcartContext()) { _context.Entry(product).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } }
public void Create(Config config) { using (var _context = new EcartContext()) { _context.Configurations.Add(config); _context.SaveChanges(); } }
public void Create(Category category) { using (var _context = new EcartContext()) { _context.Categories.Add(category); _context.SaveChanges(); } }
public void Delete(int id) { using (var _context = new EcartContext()) { var product = _context.Products.Find(id); _context.Products.Remove(product); _context.SaveChanges(); } }
public void Create(Product product) { using (var _context = new EcartContext()) { _context.Entry(product.Category).State = System.Data.Entity.EntityState.Unchanged; _context.Products.Add(product); _context.SaveChanges(); } }
public void Delete(string key) { using (var _context = new EcartContext()) { var config = _context.Configurations.Find(key); _context.Configurations.Remove(config); _context.SaveChanges(); } }
public void Delete(int id) { using (var _context = new EcartContext()) { var category = _context.Categories.Find(id); _context.Categories.Remove(category); _context.SaveChanges(); } }