Пример #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();
     }
 }