public void AddMovieToDBTest()
        {
            var movie = new AddMovieCarrier();

            movie.Title = "Friday";
            movie.DateReleased = DateTime.Parse("11/02/1995");
            movie.MPAARatingID = "4";
            movie.GenreID = "5";
            movie.RunTime = "120";
            movie.StudioID = "1";
            movie.Synopsis =
                "Two homies, Smokey and Craig, smoke up a dope dealers weed and try to figure a way to get the $200 they owe the dope dealer by 10:00pm that night. In that time they smoke weed, get jacked, and they get shot at in a drive-by.";
            movie.OwnerRatingID = "5";
            movie.Copies = "2";
            movie.ImageURL = "http://www.imdb.com/media/rm3404111360/tt0113118?ref_=tt_ov_i";
            movie.DirectorID = new List<string>() {"1", "2"};
            movie.ActorID = new List<string>() {"1", "2", "3"};

            var ops = new DVDLibraryOperations();
            ops.AddMovie(movie);

            var movieAdded = new ViewMovieCarrier();

            using (SqlConnection cn = new SqlConnection(Settings.ConnectionString))
            {
                movieAdded = cn.Query<ViewMovieCarrier>("SELECT * FROM Movies m WHERE m.Title = 'Friday'").FirstOrDefault();
            }

            Assert.AreEqual(movieAdded.Title, movie.Title);
        }
Beispiel #2
0
        public RentMovieLongViewModel(MovieReviewsNotes ratings, ViewMovieCarrier movie)
        {
            Movie = movie;
            RatingsPackage = ratings;

            NumberOfReviews = RatingsPackage.RatingsList.Count();
            try
            {
                UserRatingsAverage = Math.Truncate(RatingsPackage.RatingsList.Average()*100)/100;
            }
            catch
            {
                UserRatingsAverage = 0;
            }
        }
 public ViewMovieViewModel(ViewMovieCarrier movie)
 {
     this.movie = movie;
 }
Beispiel #4
0
        public ViewMovieCarrier GetMovieDetails(int Id)
        {
            using (SqlConnection cn = new SqlConnection(Settings.ConnectionString))
            {

                ViewMovieCarrier movie = new ViewMovieCarrier();
                var p = new DynamicParameters();
                p.Add("MovieID", Id);

                movie =
                    cn.Query<ViewMovieCarrier>("GetMovieByID", p, commandType: CommandType.StoredProcedure).FirstOrDefault();

                movie.Synopsis =
                    cn.Query<string>("SELECT m.Synopsis FROM Movies m WHERE m.MovieID = @MovieID", new {MovieID = Id})
                        .FirstOrDefault();

                movie.ImageURL =
                    cn.Query<string>("SELECT m.ImageURL FROM Movies m WHERE m.MovieID = @MovieID", new {MovieID = Id})
                        .FirstOrDefault();

                movie.Director = GetDirectorListByMovieID(Id);

                movie.Actor = GetActorListByMovieID(Id);

                return movie;
            }
        }