Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. var sessions = from s in db.Sessions where s.TheaterID == id orderby s.MovieID, s.Time select s;
  2.  
  3. public ActionResult MyAction(int id)
  4. {
  5. Theather theater = db.Theater.Find(id);
  6. ViewBag.TheaterName = theater.NomeCinema;
  7. var sessions = from s in db.Sessions where s.TheaterID == id orderby s.MovieID, s.Time select s;
  8.  
  9. var mapMovies = new Dictionary<string, List<DateTime>>();
  10.  
  11. foreach (Session s in sessions)
  12. {
  13. if ( !mapMovies.ContainsKey( s.Movie.MovieName ) )
  14. {
  15. mapMovies.Add( s.Movie.MovieName, new List<DateTime>() );
  16. }
  17. mapMovies[s.Movie.MovieName].Add(s.Time);
  18. }
  19. ViewBag.MapMovies = mapMovies;
  20. return View();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement