// DELETE: api/Employee/5 public void Delete(int id) { using (CTSDBEntities db = new CTSDBEntities()) { db.Employees.Remove(db.Employees.Find(id)); db.SaveChanges(); } }
public void Post(Employee item) { using (CTSDBEntities db = new CTSDBEntities()) { db.Employees.Add(item); db.SaveChanges(); } }
// PUT: api/Employee/5 public void Put(Employee item) { using (CTSDBEntities db = new CTSDBEntities()) { db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public void Add(Product item) { using (CTSDBEntities db = new CTSDBEntities()) { db.Products.Add(item); db.SaveChanges(); } }