Exemple #1
0
        public DTOChildrensArtwork GetArtworkDTO(string language, Artwork aw)
        {
            var texts = aw.Translation.TranslatedTexts.Where(x => x.LanguageISO == language);

            var DTO = new DTOChildrensArtwork()
            {
                Id     = aw.Id,
                ImgUrl = aw.ImgUrl,
                Artist = aw.Artist
            };

            foreach (var item in texts)
            {
                DTO.Title       = item.Title;
                DTO.Description = item.Description;
            }
            return(DTO);
        }
Exemple #2
0
        public DTOGlobalGoal GetGlobalGoalDTO(string language, GlobalGoal gg)
        {
            var texts = gg.Translation.TranslatedTexts.Where(x => x.LanguageISO == language);

            var DTO = new DTOGlobalGoal()
            {
                Id        = gg.Id,
                ImgUrl    = gg.ImgURL,
                Latitude  = gg.Latitude,
                Longitude = gg.Longitude,

                ChildrensArtworks = new List <DTOChildrensArtwork>(),
                ChildrensTexts    = new List <DTOChildrensText>(),
                LandArt           = new List <DTOLandArt>()
            };

            if (gg.AudioVideo != null)
            {
                DTO.AudioVideo = new DTOAudioVideo()
                {
                    Id         = gg.AudioVideo.Id,
                    SongArtist = gg.AudioVideo.SongArtist,
                    SongTitle  = gg.AudioVideo.SongTitle,
                    MusicUrl   = gg.AudioVideo.AudioURL,
                    VideoUrl   = gg.AudioVideo.VideoURL
                };
                foreach (var item2 in gg.AudioVideo.Translation.TranslatedTexts.Where(x => x.LanguageISO == language))
                {
                    DTO.AudioVideo.Title       = item2.Title;
                    DTO.AudioVideo.Description = item2.Description;
                }
            }

            foreach (var item in gg.ChildrensTexts)
            {
                var text = new DTOChildrensText();
                text.Author = item.Author;
                text.Id     = item.Id;

                foreach (var item2 in item.Translation.TranslatedTexts.Where(x => x.LanguageISO == language))
                {
                    text.Title       = item2.Title;
                    text.Description = item2.Description;
                }

                DTO.ChildrensTexts.Add(text);
            }

            foreach (var item in gg.Artworks)
            {
                var drawings = new DTOChildrensArtwork();
                drawings.Artist = item.Artist;
                drawings.ImgUrl = item.ImgUrl;
                drawings.Id     = item.Id;

                foreach (var item2 in item.Translation.TranslatedTexts.Where(x => x.LanguageISO == language))
                {
                    drawings.Title       = item2.Title;
                    drawings.Description = item2.Description;
                }

                DTO.ChildrensArtworks.Add(drawings);
            }

            foreach (var item in gg.LandArts)
            {
                var landArt = new DTOLandArt();
                landArt.ImgUrl = item.ImgUrl;
                landArt.Id     = item.Id;

                foreach (var item2 in item.Translation.TranslatedTexts.Where(x => x.LanguageISO == language))
                {
                    landArt.Title       = item2.Title;
                    landArt.Description = item2.Description;
                }

                DTO.LandArt.Add(landArt);
            }

            foreach (var item in texts)
            {
                DTO.Title       = item.Title;
                DTO.Description = item.Description;
            }
            ;

            return(DTO);
        }