コード例 #1
0
 public virtual int Insert(object obj)
 {
     try
     {
         using (var db = new ClinicDB())
         {
             db.Entry(obj).State = System.Data.Entity.EntityState.Added;
             return(db.SaveChanges());
         }
     }
     catch (Exception e)
     {
         return(0);
     }
 }
コード例 #2
0
 public virtual bool Delete(object obj)
 {
     try
     {
         using (var db = new ClinicDB())
         {
             db.Entry(obj).State = System.Data.Entity.EntityState.Deleted;
             return(db.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }