예제 #1
0
 public void DeleteCannoe(Cannoe cannoe)
 {
     cannoe = _db.Cannoes.FirstOrDefault(cust => cust.CannoeId == cannoe.CannoeId);
     if (cannoe != null)
     {
         _db.Entry(cannoe).State = EntityState.Deleted;
         _db.SaveChanges();
     }
     else
     {
         throw new Exception("Cannoe Id cannot be found");
     }
 }
예제 #2
0
 public void UpdateCannoe(Cannoe cannoe)
 {
     cannoe = _db.Cannoes.FirstOrDefault(cust => cust.CannoeId == cannoe.CannoeId);
     _db.Entry(cannoe).State = EntityState.Modified;
     _db.SaveChanges();
 }
예제 #3
0
 public void AddCannoe(Cannoe cannoe)
 {
     _db.Cannoes.Add(cannoe);
     _db.SaveChanges();
 }