コード例 #1
0
        private MovieDTOCollection MovieCollectionToDTO(MovieCollection movieCollection)
        {
            MovieDTOCollection tempList = new MovieDTOCollection();
            MovieDTO tempItem;

            if (movieCollection != null)
            {
                foreach (Movie item in movieCollection)
                {
                    tempItem = new MovieDTO();
                    tempItem.MovieId = item.MovieId;

                    if (item.MovieTitle != null)
                    {
                        tempItem.MovieTitle = item.MovieTitle;
                    }
                    if (item.RatingName != null)
                    {
                        tempItem.RatingsName = item.RatingName;
                    }
                    if (item.YearReleased != null)
                    {
                        tempItem.YearReleased = item.YearReleased.ToString();
                    }

                    tempList.Add(tempItem);
                }
            }
            return tempList;
        }
コード例 #2
0
        public MovieDTO SaveMovie(string movieId, MovieDTO movieToSave)
        {
            //Updates/Saves movie
            int movieIdReturnValue = MovieBLL.Save(Convert.ToInt32(movieToSave.MovieId), this.DTOItemToMovie(movieToSave));

            //Gets the recently updated/saved items
            Movie updatedItem = MovieBLL.GetItem(movieIdReturnValue);

            //Converts the updated drawing date items back to DTO
            return this.MovieItemToDTO(updatedItem);
        }
コード例 #3
0
        private Movie DTOItemToMovie(MovieDTO movieDTO)
        {
            Movie tempItem = new Movie();

            if (movieDTO != null)
            {
                tempItem.MovieId = movieDTO.MovieId;
                tempItem.RatingId = Convert.ToInt32(movieDTO.RatingId);

                if (!string.IsNullOrEmpty(movieDTO.MovieTitle))
                {
                    tempItem.MovieTitle = movieDTO.MovieTitle;
                }
                if (!string.IsNullOrEmpty(movieDTO.YearReleased))
                {
                    tempItem.YearReleased = Convert.ToInt32(movieDTO.YearReleased);
                }
            }
            return tempItem;
        }
コード例 #4
0
        private MovieDTO MovieItemToDTO(Movie movie)
        {
            MovieDTO tempItem = new MovieDTO();

            if (movie != null)
            {
                tempItem.MovieId = movie.MovieId;

                if (!string.IsNullOrEmpty(movie.MovieTitle))
                {
                    tempItem.MovieTitle = movie.MovieTitle;
                }
                if (!string.IsNullOrEmpty(movie.RatingName.ToString()))
                {
                    tempItem.RatingsName = movie.RatingName.ToString();
                }
                if (!string.IsNullOrEmpty(movie.YearReleased.ToString()))
                {
                    tempItem.YearReleased = movie.YearReleased.ToString();
                }
            }
            return tempItem;
        }