public IActionResult Index() { ApplicationDbContext db = new ApplicationDbContext(new Microsoft.EntityFrameworkCore.DbContextOptions <ApplicationDbContext>()); List <ScheduleModel> model = new List <ScheduleModel>(); foreach (ScheduleModel schedule in db.Schedules.Where(i => i.Starttime.Date >= DateTime.Today).Where(i => i.Starttime.Date <= DateTime.Today.AddDays(7)).ToList()) { if (!model.Where(m => m.MovieID == schedule.MovieID).Any()) { model.Add(schedule); } } List <MovieModel> movies = new List <MovieModel>(); foreach (var movie in TmdbApi.Instance.GetUpcoming().Results.Where(m => m.ReleaseDate.Value.Date >= DateTime.Today)) { if (!model.Where(x => x.MovieID == movie.Id).Any()) { movies.Add(MovieModel.GetModelByID(movie.Id)); } } HomeViewModel HVModel = new HomeViewModel() { Schedules = model, Movies = movies }; return(View(HVModel)); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(145, 74, true); WriteLiteral("\n\n<div class=\"container\">\n <div class=\"row\" style=\"margin-left:50px;\">\n"); EndContext(); #line 8 "/Users/joeykieboom/Desktop/dot-net-core-theater/Views/Partials/MoviesToday.cshtml" foreach (ScheduleModel schedule in Model.Where(i => i.Starttime.Date == DateTime.Today).ToList()) { #line default #line hidden BeginContext(334, 51, true); WriteLiteral(" <div class=\"col-md-4\">\n "); EndContext(); BeginContext(386, 103, false); #line 11 "/Users/joeykieboom/Desktop/dot-net-core-theater/Views/Partials/MoviesToday.cshtml" Write(await Html.PartialAsync("~/Views/Partials/MovieCard.cshtml", MovieModel.GetModelByID(schedule.MovieID))); #line default #line hidden EndContext(); BeginContext(489, 20, true); WriteLiteral("\n </div>\n"); EndContext(); #line 13 "/Users/joeykieboom/Desktop/dot-net-core-theater/Views/Partials/MoviesToday.cshtml" } #line default #line hidden BeginContext(519, 18, true); WriteLiteral(" </div>\n</div>\n"); EndContext(); }
// GET: OrderModels/Create public IActionResult Create(int?movieID) { ApplicationDbContext db = new ApplicationDbContext(new DbContextOptions <ApplicationDbContext>()); MovieModel movie = MovieModel.GetModelByID(Convert.ToInt32(movieID)); List <ScheduleModel> schedule = db.Schedules.Where(s => s.MovieID == Convert.ToInt32(movieID)).Where(s => s.Starttime.Date == DateTime.Now.Date).Include(h => h.Hall).ToListAsync().Result; OrderCreateViewModel model = new OrderCreateViewModel() { MovieModel = movie, SchedulesModel = schedule }; return(View(model)); }
public ActionResult Overview() { ApplicationDbContext db = new ApplicationDbContext(new Microsoft.EntityFrameworkCore.DbContextOptions <ApplicationDbContext>()); // var Movies = TmdbApi.Instance.GetNowInTheater(); var _movies = db.Schedules.Where(m => m.Starttime.Date == DateTime.Today).ToList(); // var _movies = TmdbApi.Instance.GetNowInTheater().Results; List <MovieModel> movies = new List <MovieModel>(); foreach (var movie in _movies) { //movies.Add(movie); if (!movies.Where(m => m.TMDBID == movie.MovieID).Any()) { movies.Add(MovieModel.GetModelByID(movie.MovieID)); } } return(View("QuickAccessOverview", movies)); }