示例#1
0
        public MovieSearch BuildMovieSearchFromTextBoxes()
        {
            MovieSearch movieSearch = new MovieSearch
            {
                Title             = GetMovieTitleFromTextBox(),
                Year              = GetYearFromTextBox(),
                Runtime           = GetMovieRuntimeFromTextBox(),
                ActorFirstName    = GetActorFirstNameFromTextBox(),
                ActorLastName     = GetActorLastNameFromTextBox(),
                DirectorFirstName = GetDirectorFirstNameFromTextBox(),
                DirectorLastName  = GetDirectorLastNameFromTextBox()
            };

            return(movieSearch);
        }
示例#2
0
 public List <Movie> SearchMovies(MovieSearch movieSearch)
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnValue("MyMediaDB")))
     {
         return(connection.Query <Movie>("dbo.spSearch_Movies_By_All @Title, " +
                                         "@Runtime, " +
                                         "@Year, " +
                                         "@ActorFirstName, " +
                                         "@ActorLastName, " +
                                         "@DirectorFirstName," +
                                         "@DirectorLastName",
                                         new
         {
             movieSearch.Title,
             movieSearch.Runtime,
             movieSearch.Year,
             movieSearch.ActorFirstName,
             movieSearch.ActorLastName,
             movieSearch.DirectorFirstName,
             movieSearch.DirectorLastName
         }).ToList());
     }
 }