Пример #1
0
        private static void Rate(string connectionString)
        {
            var ctx        = new ImdbContext(connectionString);
            var connection = (NpgsqlConnection)ctx.Database.GetDbConnection();

            connection.Open();
            var cmd = new NpgsqlCommand($"select rate('hans1', 'tt11097072', 2)", connection);

            cmd.ExecuteNonQuery();
        }
Пример #2
0
        private static void Bookmark(string connectionString)
        {
            var ctx        = new ImdbContext(connectionString);
            var connection = (NpgsqlConnection)ctx.Database.GetDbConnection();

            connection.Open();
            var cmd = new NpgsqlCommand($"select bookmark('alex5', 'Mads Mikkelsen', 'Act')", connection);

            cmd.ExecuteNonQuery();
        }
Пример #3
0
        // Finds popular actors the ref for this method is FPA
        private static void FindPopularActors(string connectionString)
        {
            var ctx    = new ImdbContext(connectionString);
            var result = ctx.FindPopularActors.FromSqlInterpolated($"select * from popular_actors(10) ");

            foreach (var FindPopularActors in result)
            {
                Console.WriteLine($"{ FindPopularActors.primaryname}, {FindPopularActors.rating}");
            }
        }
Пример #4
0
        private static void CreateUser(string connectionString)
        {
            var ctx        = new ImdbContext(connectionString);
            var connection = (NpgsqlConnection)ctx.Database.GetDbConnection();

            connection.Open();
            var cmd = new NpgsqlCommand($"select create_user('ddheas', 'eerrrghg')", connection);

            cmd.ExecuteNonQuery();
        }
Пример #5
0
        public static void StringSearch(string connectionString)
        {
            var ctx    = new ImdbContext(connectionString);
            var result = ctx.StringSearch.FromSqlInterpolated($"select * from string_search('hans1','vampire')");

            foreach (var StringSearch in result)
            {
                Console.WriteLine($"{StringSearch.tconst}, { StringSearch.primarytitle}");
            }
        }
Пример #6
0
        private static void NameRating(string connectionString)
        {
            var ctx    = new ImdbContext(connectionString);
            var result = ctx.NameRating.FromSqlInterpolated($"select name_rating('Mads Mikkelsen')");

            foreach (var NameRating in result)
            {
                Console.WriteLine($"{ NameRating.primaryname}");
            }
        }
Пример #7
0
        //Find_Coplayers

        private static void Login(string connectionString)
        {
            var ctx        = new ImdbContext(connectionString);
            var connection = (NpgsqlConnection)ctx.Database.GetDbConnection();

            connection.Open();
            var cmd = new NpgsqlCommand($"select login('rasmus2', 'baad')", connection);

            cmd.ExecuteNonQuery();
        }
Пример #8
0
        //This method searches for a name, the ref for this method is NS

        public static void NameSearch(string connectionString)
        {
            var usernam    = "hans1";
            var searchterm = "Mads";

            var ctx    = new ImdbContext(connectionString);
            var result = ctx.NameSearch.FromSqlInterpolated($"select * from name_search({usernam},{searchterm})");

            foreach (var NameSearch in result)
            {
                Console.WriteLine($"{ NameSearch.nconst}, { NameSearch.primaryname}");
            }
        }
Пример #9
0
        private static void AddRatingHistory(string connectionString)
        {
            var usernam = "hans1";
            var tconst  = "tt10850402";
            int rating  = 9;


            var ctx = new ImdbContext(connectionString);

            var connection = (NpgsqlConnection)ctx.Database.GetDbConnection();

            connection.Open();
            var cmd = new NpgsqlCommand($"select add_rating_history({usernam}, {tconst}, {rating})", connection);

            cmd.ExecuteNonQuery();
        }