private void addStyles(AlbumModel album)
        {
            List <StyleModel> styles = _sourceManagerEF.GetStyles();

            if (styles != null && styles.Count != 0)
            {
                foreach (var style in styles)
                {
                    style.Album    = new AlbumModel();
                    style.Album.ID = album.ID;
                    _context.Styles.Add(style);
                    // _context.SaveChanges();
                }
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> GetMyAlbum(string link)
        {
            UserModel user = await _userManager.GetUserAsync(User);

            AlbumModel album = _sourceManagerEF.Load(link).GetAlbum();

            album.User    = user;
            album.Tracks  = _sourceManagerEF.GetTracks();
            album.Images  = _sourceManagerEF.GetImages();
            album.Videos  = _sourceManagerEF.GetVideos();
            album.Genres  = _sourceManagerEF.GetGenres();
            album.Styles  = _sourceManagerEF.GetStyles();
            album.Artists = _sourceManagerEF.GetArtist();
            AlbumThumbModel albumThumb = _sourceManagerEF.GetAlbumThumb();

            albumThumb.User  = user;
            album.AlbumThumb = albumThumb;

            _context.Albums.Add(album);

            var result = _context.SaveChanges();

            return(Ok());
        }