#95: Id changes to models (#99)

* #95: Updated Id of the CoverArt model

* Model and migration changes
This commit was merged in pull request #99.
This commit is contained in:
Kun Deng
2024-06-21 20:30:23 -04:00
committed by GitHub
parent 71656aa940
commit 4b3fa78336
32 changed files with 118 additions and 130 deletions
+6 -6
View File
@@ -25,28 +25,28 @@ public class SongContext : DbContext
.Property(s => s.Year)
.IsRequired(false);
modelBuilder.Entity<Song>()
.Property(s => s.GenreID)
.Property(s => s.GenreId)
.IsRequired(false);
modelBuilder.Entity<Song>()
.Property(s => s.ArtistID)
.Property(s => s.ArtistId)
.IsRequired(false);
modelBuilder.Entity<Song>()
.Property(s => s.AlbumID)
.Property(s => s.AlbumId)
.IsRequired(false);
modelBuilder.Entity<Song>()
.Property(s => s.CoverArtID)
.Property(s => s.CoverArtId)
.IsRequired(false);
}
public Song RetrieveRecord(Song song)
{
return Songs.FirstOrDefault(sng => sng.SongID == song.SongID);
return Songs.FirstOrDefault(sng => sng.Id == song.Id);
}
public bool DoesRecordExist(Song song)
{
return Songs.FirstOrDefault(sng => sng.SongID == song.SongID) != null ? true : false;
return Songs.FirstOrDefault(sng => sng.Id == song.Id) != null ? true : false;
}
}