Beispiel #1
0
 public List <Pub> GetPubs()
 {
     using (var pubContext = new PubDataContext())
     {
         return(pubContext.Pubs.Include(pub => pub.Images).ToList());
     }
 }
Beispiel #2
0
 public Pub GetPub(int id)
 {
     using (var pubContext = new PubDataContext())
     {
         return(pubContext.Pubs
                .Include(p => p.Comments)
                .Include(p => p.Images)
                .FirstOrDefault(p => p.Id == id));
     }
 }