#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
+2 -2
View File
@@ -22,11 +22,11 @@ public class AlbumContext : DbContext
public Album RetrieveRecord(Album album)
{
return Albums.FirstOrDefault(alb => alb.AlbumID == album.AlbumID);
return Albums.FirstOrDefault(alb => alb.Id == album.Id);
}
public bool DoesRecordExist(Album album)
{
return Albums.FirstOrDefault(alb => alb.AlbumID == album.AlbumID) != null ? true : false;
return Albums.FirstOrDefault(alb => alb.Id == album.Id) != null ? true : false;
}
}
+2 -2
View File
@@ -23,12 +23,12 @@ public class ArtistContext : DbContext
public Artist RetrieveRecord(Artist artist)
{
return Artists.FirstOrDefault(arst => arst.ArtistID == artist.ArtistID);
return Artists.FirstOrDefault(arst => arst.Id == artist.Id);
}
public bool DoesRecordExist(Artist artist)
{
return Artists.FirstOrDefault(arst => arst.ArtistID == artist.ArtistID) != null ? true : false;
return Artists.FirstOrDefault(arst => arst.Id == artist.Id) != null ? true : false;
}
}
+2 -2
View File
@@ -22,11 +22,11 @@ public class CoverArtContext : DbContext
public CoverArt RetrieveRecord(CoverArt cover)
{
return CoverArtImages.FirstOrDefault(cov => cov.CoverArtID == cover.CoverArtID);
return CoverArtImages.FirstOrDefault(cov => cov.Id == cover.Id);
}
public bool DoesRecordExist(CoverArt cover)
{
return CoverArtImages.FirstOrDefault(cov => cov.CoverArtID == cover.CoverArtID) != null ? true : false;
return CoverArtImages.FirstOrDefault(cov => cov.Id == cover.Id) != null ? true : false;
}
}
+2 -2
View File
@@ -22,11 +22,11 @@ public class GenreContext : DbContext
public Genre RetrieveRecord(Genre genre)
{
return Genres.FirstOrDefault(gnr => gnr.GenreID == genre.GenreID);
return Genres.FirstOrDefault(gnr => gnr.Id == genre.Id);
}
public bool DoesRecordExist(Genre genre)
{
return Genres.FirstOrDefault(gnr => gnr.GenreID == genre.GenreID) != null ? true : false;
return Genres.FirstOrDefault(gnr => gnr.Id == genre.Id) != null ? true : false;
}
}
+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;
}
}
+2 -2
View File
@@ -32,11 +32,11 @@ public class UserContext : DbContext
public User RetrieveRecord(User user)
{
return Users.FirstOrDefault(usr => usr.UserID == user.UserID);
return Users.FirstOrDefault(usr => usr.Id == user.Id);
}
public bool DoesRecordExist(User user)
{
return Users.FirstOrDefault(usr => usr.UserID == user.UserID) != null ? true : false;
return Users.FirstOrDefault(usr => usr.Id == user.Id) != null ? true : false;
}
}