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()); } }
public List <T> GetAll() { using (var db = new YGFLDBEntities()) { return(db.Set <T>().ToList()); } }
public T FindById(int id) { using (var db = new YGFLDBEntities()) { return(db.Set <T>().Find(id)); } }
public void Add(T entity) { using (var db = new YGFLDBEntities()) { db.Set <T>().Add(entity); db.SaveChanges(); } }