Exemplo n.º 1
0
 public List <T> GetList()
 {
     using (var db = new WebContextDb())
     {
         return(db.Set <T>().ToList());
     }
 }
 public Artist GetById(int id)
 {
     using (var db = new WebContextDb())
     {
         return(db.Artist.FirstOrDefault(p => p.ArtistId == id));
     }
 }
 public List <Artist> GetlistBySize(int size)
 {
     using (var db = new WebContextDb())
     {
         return(db.Artist.OrderByDescending(p => p.ArtistId).
                Take(size).ToList());
     }
 }
Exemplo n.º 4
0
 public int Delete(T entity)
 {
     using (var db = new WebContextDb())
     {
         db.Entry(entity).State = System.Data.Entity.EntityState.Deleted;
         return(db.SaveChanges());
     }
 }