Exemplo n.º 1
0
        /// <summary>
        /// Convert a full movie model to a full movie entity
        /// </summary>
        /// <param name="movie">The movie to convert</param>
        /// <returns>Full movie entity</returns>
        private static Entity.Movie.MovieFull MovieFullFromModelToEntity(MovieFull movie)
        {
            var torrents = movie.Torrents.Select(torrent => new Entity.Movie.Torrent
            {
                DateUploaded = torrent.DateUploaded,
                Url = torrent.Url,
                Quality = torrent.Quality,
                DateUploadedMix = torrent.DateUploadedMix,
                Framerate = torrent.Framerate,
                Hash = torrent.Hash,
                Peers = torrent.Peers,
                Resolution = torrent.Resolution,
                Seeds = torrent.Seeds,
                Size = torrent.Size,
                SizeBytes = torrent.SizeBytes
            }).ToList();

            var genres = movie.Genres.Select(genre => new Genre
            {
                Name = genre
            }).ToList();

            var images = new Images
            {
                BackgroundImage = movie.Images.BackgroundImage,
                MediumCoverImage = movie.Images.MediumCoverImage,
                SmallCoverImage = movie.Images.SmallCoverImage,
                LargeCoverImage = movie.Images.LargeCoverImage,
                LargeScreenshotImage1 = movie.Images.LargeScreenshotImage1,
                LargeScreenshotImage2 = movie.Images.LargeScreenshotImage2,
                LargeScreenshotImage3 = movie.Images.MediumScreenshotImage3,
                MediumScreenshotImage3 = movie.Images.MediumScreenshotImage3,
                MediumScreenshotImage1 = movie.Images.MediumScreenshotImage1,
                MediumScreenshotImage2 = movie.Images.MediumScreenshotImage2
            };

            var actors = movie.Actors.Select(actor => new Actor
            {
                CharacterName = actor.CharacterName,
                MediumImage = actor.MediumImage,
                Name = actor.Name,
                SmallImage = actor.SmallImage,
                SmallImagePath = actor.SmallImagePath
            }).ToList();

            var directors = movie.Directors.Select(actor => new Director
            {
                MediumImage = actor.MediumImage,
                Name = actor.Name,
                SmallImage = actor.SmallImage,
                SmallImagePath = actor.SmallImagePath
            }).ToList();

            var movieFull = new Entity.Movie.MovieFull
            {
                MovieId = movie.Id,
                Year = movie.Year,
                Language = movie.Language,
                ImdbCode = movie.ImdbCode,
                Title = movie.Title,
                Id = movie.Id,
                DateUploaded = movie.DateUploaded,
                Runtime = movie.Runtime,
                Url = movie.Url,
                TitleLong = movie.TitleLong,
                Torrents = torrents,
                Genres = genres,
                DateUploadedUnix = movie.DateUploadedUnix,
                MpaRating = movie.MpaRating,
                Rating = movie.RatingValue,
                Images = images,
                DescriptionFull = movie.DescriptionFull,
                Actors = actors,
                Directors = directors,
                DescriptionIntro = movie.DescriptionIntro,
                DownloadCount = movie.DownloadCount,
                LikeCount = movie.LikeCount,
                RtAudienceRating = movie.RtAudienceRating,
                RtAudienceScore = movie.RtAudienceScore,
                RtCriticsRating = movie.RtCriticsRating,
                RtCrtiticsScore = movie.RtCrtiticsScore,
                YtTrailerCode = movie.YtTrailerCode,
                HasBeenSeen = movie.HasBeenSeen,
                IsFavorite = movie.IsFavorite
            };
            return movieFull;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Convert a full movie model to a full movie entity
        /// </summary>
        /// <param name="movie">The movie to convert</param>
        /// <returns>Full movie entity</returns>
        private static Entity.Movie.MovieFull MovieFullFromModelToEntity(MovieFull movie)
        {
            var torrents = new List<Entity.Movie.Torrent>();
            foreach (var torrent in movie.Torrents)
            {
                torrents.Add(new Entity.Movie.Torrent
                {
                    DateUploaded = torrent.DateUploaded,
                    Url = torrent.Url,
                    Quality = torrent.Quality,
                    DateUploadedMix = torrent.DateUploadedMix,
                    Framerate = torrent.Framerate,
                    Hash = torrent.Hash,
                    Peers = torrent.Peers,
                    Resolution = torrent.Resolution,
                    Seeds = torrent.Seeds,
                    Size = torrent.Size,
                    SizeBytes = torrent.SizeBytes
                });
            }

            var genres = new List<Genre>();
            foreach (var genre in movie.Genres)
            {
                genres.Add(new Genre
                {
                    Name = genre
                });
            }

            var images = new Images
            {
                BackgroundImage = movie.Images.BackgroundImage,
                MediumCoverImage = movie.Images.MediumCoverImage,
                SmallCoverImage = movie.Images.SmallCoverImage,
                LargeCoverImage = movie.Images.LargeCoverImage,
                LargeScreenshotImage1 = movie.Images.LargeScreenshotImage1,
                LargeScreenshotImage2 = movie.Images.LargeScreenshotImage2,
                LargeScreenshotImage3 = movie.Images.MediumScreenshotImage3,
                MediumScreenshotImage3 = movie.Images.MediumScreenshotImage3,
                MediumScreenshotImage1 = movie.Images.MediumScreenshotImage1,
                MediumScreenshotImage2 = movie.Images.MediumScreenshotImage2
            };

            var actors = new List<Actor>();
            foreach (var actor in movie.Actors)
            {
                actors.Add(new Actor
                {
                    CharacterName = actor.CharacterName,
                    MediumImage = actor.MediumImage,
                    Name = actor.Name,
                    SmallImage = actor.SmallImage,
                    SmallImagePath = actor.SmallImagePath
                });
            }

            var directors = new List<Director>();
            foreach (var actor in movie.Directors)
            {
                directors.Add(new Director
                {
                    MediumImage = actor.MediumImage,
                    Name = actor.Name,
                    SmallImage = actor.SmallImage,
                    SmallImagePath = actor.SmallImagePath
                });
            }

            var movieFull = new Entity.Movie.MovieFull
            {
                MovieId = movie.Id,
                Year = movie.Year,
                Language = movie.Language,
                ImdbCode = movie.ImdbCode,
                Title = movie.Title,
                Id = movie.Id,
                DateUploaded = movie.DateUploaded,
                Runtime = movie.Runtime,
                Url = movie.Url,
                TitleLong = movie.TitleLong,
                Torrents = torrents,
                Genres = genres,
                DateUploadedUnix = movie.DateUploadedUnix,
                MpaRating = movie.MpaRating,
                Rating = movie.RatingValue,
                Images = images,
                DescriptionFull = movie.DescriptionFull,
                Actors = actors,
                Directors = directors,
                DescriptionIntro = movie.DescriptionIntro,
                DownloadCount = movie.DownloadCount,
                LikeCount = movie.LikeCount,
                RtAudienceRating = movie.RtAudienceRating,
                RtAudienceScore = movie.RtAudienceScore,
                RtCriticsRating = movie.RtCriticsRating,
                RtCrtiticsScore = movie.RtCrtiticsScore,
                YtTrailerCode = movie.YtTrailerCode,
                HasBeenSeen = movie.HasBeenSeen,
                IsFavorite = movie.IsFavorite
            };
            return movieFull;
        }