Пример #1
0
        public ActionResult addProjectionsForDay([Bind(Include = "StartDate,EndDate")] DateRangeInputModel dateRange)
        {
            MovieBotContext context = new MovieBotContext();

            foreach (var date in DatabaseAdapter.EachDay(dateRange.StartDate, dateRange.EndDate))
            {
                IEnumerable <Movie>             movies       = context.Movies.ToList();
                IEnumerable <Cinema>            cinemas      = context.Cinemas.ToList();
                IEnumerable <CinemaProjections> cprojections = getDummyCinemaProjections(movies, cinemas, date);
                cprojections.ToList <CinemaProjections>().ForEach(
                    c => c.MovieProjections.ToList().ForEach(
                        m => m.Projections.ToList().ForEach(
                            p => context.Projections.Add(p)
                            )
                        )
                    );
            }
            context.SaveChanges();
            return(View());
        }