Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Gig
- {
- public int Id { get; set; }
- public string Name { get; set; }
- public string ArtistId { get; set; }
- public string Venue { get; set; }
- public DateTime DateTime { get; set; }
- public int GenreId { get; set; }
- public bool IsCanceled { get; set; }
- // Navigation property here
- public virtual Genre Genre { get; set; }
- public virtual ApplicationUser Artist { get; set; }
- }
- public class Genre
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
- public class ApplicationUser : IdentityUser
- {
- public string Name { get; set; }
- }
- var gigs = db.Gigs
- // Iam eager loading property here
- .Include(g => g.Artist)
- .Include(g => g.Genre)
- .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled)
- .GroupBy(x=>x.DateTime.Month).OrderBy(x=>x.Key);
- var gigs = db.Gigs
- //I can get Artist and Genre data
- .Include(g => g.Artist)
- .Include(g => g.Genre)
- .Where(g => g.DateTime > DateTime.Now && !g.IsCanceled)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement