private void addArtists(AlbumModel album) { List <ArtistModel> artists = _sourceManagerEF.GetArtist(); if (artists != null) { foreach (var artist in artists) { artist.Album = new AlbumModel(); artist.Album.ID = album.ID; _context.Artists.Add(artist); //_context.SaveChanges(); } } }
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()); }