public async Task <int> CreateAsync(AlbumDTO album) { var entity = new Album { Title = album.Title, ArtistId = album.ArtistId, Year = album.Year, Cover = album.Cover }; _context.Albums.Add(entity); return(await _context.SaveChangesAsync()); }
public async Task <bool> UpdateAsync(AlbumDTO album) { var entity = await _context.Albums.FindAsync(album.Id); if (entity == null) { return(false); } entity.Title = album.Title; entity.ArtistId = album.ArtistId; entity.Year = album.Year; entity.Cover = album.Cover; await _context.SaveChangesAsync(); return(true); }