Esempio n. 1
0
 // DELETE: api/Employee/5
 public void Delete(int id)
 {
     using (CTSDBEntities db = new CTSDBEntities())
     {
         db.Employees.Remove(db.Employees.Find(id));
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 public void Post(Employee item)
 {
     using (CTSDBEntities db = new CTSDBEntities())
     {
         db.Employees.Add(item);
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 // 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();
     }
 }
Esempio n. 4
0
 public void Add(Product item)
 {
     using (CTSDBEntities db = new CTSDBEntities())
     {
         db.Products.Add(item);
         db.SaveChanges();
     }
 }