Пример #1
0
        public Artist GetById(int id)
        {
            var args  = new object[] { id };
            var query = @"select artist_id as Id , name as Name from artist where artist_id = @0";

            return(_runner.ExecuteToSingle <Artist>(query, args));
        }
Пример #2
0
        public Album GetById(int albumId)
        {
            var args = new object[] { albumId };
            var sql  = "select album_id as Id,title as Title,artist_id as ArtistId from album where album_id=@0";

            return(_runner.ExecuteToSingle <Album>(sql, args));
        }
Пример #3
0
        public Actor GetById(int id)
        {
            var args = new Object[] { id };
            var sql  =
                "select actor_id as Id ,first_name as FirstName,last_name as LastName,last_update as LastUpdate from actor where actor_id = @0;";

            return(_runner.ExecuteToSingle <Actor>(sql, args));
        }
Пример #4
0
        public void GetArtistById()
        {
            var result =
                _runner.ExecuteToSingle <Artist>("select artist_id as Id , name as Name from artist where artist_id = @0", new object[] { 12 });

            Assert.Equal(result == null, false);
            Assert.Equal(result.Name == "Black Sabbath", true);
        }
Пример #5
0
        public Film FilmCategories(int filmId)
        {
            var args        = new object[] { filmId };
            var filmSql     = "select film.film_id as Id,title as Title,description as Description from film where film_id=@0;";
            var categorySql =
                "select film_category.category_id as Id ,category.name as Name from FROM category INNER JOIN film_category ON film_category.category_id = category.category_id WHERE film_category.film_id = @0;";
            var result = _runner.ExecuteToSingle <Film>(filmSql + categorySql, args);

            return(result);
        }
Пример #6
0
        public PlayList GetById(int playlistId)
        {
            var sql = @"select playlist_id as Id,name as Name from playlist where playlist_id = @0 order by playlist_id;";

            return(_runner.ExecuteToSingle <PlayList>(sql, playlistId));
        }