Model and migration changes

This commit is contained in:
kdeng00
2024-06-20 17:12:10 -04:00
parent 5c913869b4
commit f3eccfd46e
32 changed files with 111 additions and 123 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 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;
}
}
+5 -5
View File
@@ -25,13 +25,13 @@ 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)
@@ -41,12 +41,12 @@ public class SongContext : DbContext
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;
}
}