예제 #1
0
        public static Movie ToMovie(MoviePostModel movie)
        {
            Genre genre = Models.Genre.Action;

            if (movie.Genre == "Comedy")
            {
                genre = Models.Genre.Comedy;
            }
            if (movie.Genre == "Horror")
            {
                genre = Models.Genre.Horror;
            }
            if (movie.Genre == "Thriller")
            {
                genre = Models.Genre.Thriller;
            }


            return(new Movie
            {
                Title = movie.Title,
                Duration = movie.Duration,
                Genre = genre
            });
        }
예제 #2
0
        public static Movie ToMovie(MoviePostModel movie)
        {
            Genre genre = Models.Genre.Action;

            if (movie.Genre == "Comedy")
            {
                genre = Models.Genre.Comedy;
            }
            if (movie.Genre == "Horror")
            {
                genre = Models.Genre.Horror;
            }
            if (movie.Genre == "Thriller")
            {
                genre = Models.Genre.Thriller;
            }

            WatchedState watchedState = Models.WatchedState.Yes;

            if (movie.WatchedState == "No")
            {
                watchedState = Models.WatchedState.No;
            }
            if (movie.WatchedState == "InProgress")
            {
                watchedState = Models.WatchedState.No;
            }


            return(new Movie
            {
                Title = movie.Title,
                Duration = movie.Duration,
                Genre = genre,
                WatchedState = watchedState,
                DateAdded = movie.DateAdded,
                DateClosed = movie.DateClosed,
                Comments = movie.Comments
            });
        }