static void Main(string[] args)
        {
            var context = new MoviesContext();


            Console.WriteLine(context.Countries.Count());

        }
        static void Main(string[] args)
        {
            var context = new MoviesContext();
            var adultsMovies = context.Movies
                .Where(m => m.AgeRestriction == AgeRestriction.Adult)
                .Select(m => new
                {
                    title = m.Title,
                    ratingsGiven = m.Ratings.Count
                }).OrderBy(m=>m.title).ThenBy(m=>m.ratingsGiven);

            var json = new JavaScriptSerializer().Serialize(adultsMovies);
            Console.WriteLine(json);
            System.IO.File.WriteAllText(@"../../adult-movies.json", json);
        }
        static void Main(string[] args)
        {
            var db  =new MoviesContext();

            var topFavMovies = db.Movies
                .Where(m => m.AgeRestriction == AgeRestriction.Teen)
                .OrderByDescending(m => m.Users.Count).ThenBy(m => m.Title)
                .Select(m => new
                {
                    isbn = m.ISBN,
                    title = m.Title,
                    favouritedBy = m.Users.Select(u => u.UserName),
                }).Take(10);
            var json = new JavaScriptSerializer().Serialize(topFavMovies);
            Console.WriteLine(json);
            System.IO.File.WriteAllText(@"../../top-10-favourite-movies.json", json);

            

        }