예제 #1
0
 public void DeleteById(int id)
 {
     using (var db = new YGFLDBEntities())
     {
         T entity = db.Set <T>().Find(id);
         if (entity != null)
         {
             db.Set <T>().Remove(entity);
         }
         db.SaveChanges();
     }
 }
 public List <Artist> GetAllActive()
 {
     using (var db = new YGFLDBEntities())
     {
         return(db.Set <Artist>().Where(a => a.IsActive == true).ToList());
     }
 }
예제 #3
0
 public List <T> GetAll()
 {
     using (var db = new YGFLDBEntities())
     {
         return(db.Set <T>().ToList());
     }
 }
예제 #4
0
 public T FindById(int id)
 {
     using (var db = new YGFLDBEntities())
     {
         return(db.Set <T>().Find(id));
     }
 }
예제 #5
0
 public void Add(T entity)
 {
     using (var db = new YGFLDBEntities())
     {
         db.Set <T>().Add(entity);
         db.SaveChanges();
     }
 }