public static List <Seance> All() { using var db = new DbCinema(); var query = from seance in db.Seances join movie in db.Movies on seance.MovieId equals movie.Id join hall in db.Halls on seance.HallId equals hall.Id select Seance.Build(seance, movie, hall); var seances = query.ToList(); return(seances); }
public static Seance Get(int id) { using var db = new DbCinema(); var queryable = from seance in db.Seances join movie in db.Movies on seance.MovieId equals movie.Id join hall in db.Halls on seance.HallId equals hall.Id where seance.Id == id select Seance.Build(seance, movie, hall); var singleSeance = queryable.ToList()[0]; return(singleSeance); }