From 4943788e23c242d9fbafaf708b6519cd92d78d4f Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Tue, 22 Jun 2021 15:00:03 +1000 Subject: [PATCH] chap4.1: Modeling the Music Store --- MvcMusicStore/Models/Album.cs | 19 +++++++++++++++++++ MvcMusicStore/Models/Artist.cs | 13 +++++++++++++ MvcMusicStore/Models/Genre.cs | 15 +++++++++++++++ MvcMusicStore/MvcMusicStore.csproj | 4 +++- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 MvcMusicStore/Models/Album.cs create mode 100644 MvcMusicStore/Models/Artist.cs create mode 100644 MvcMusicStore/Models/Genre.cs diff --git a/MvcMusicStore/Models/Album.cs b/MvcMusicStore/Models/Album.cs new file mode 100644 index 0000000..f6b4907 --- /dev/null +++ b/MvcMusicStore/Models/Album.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace MvcMusicStore.Models +{ + public class Album + { + public virtual int AlbumId { get; set; } + public virtual int GenreId { get; set; } + public virtual int ArtistId { get; set; } + public virtual string Title { get; set; } + public virtual decimal Price { get; set; } + public virtual string AlbumArtUrl { get; set; } + public virtual Genre Genre { get; set; } + public virtual Artist Artist { get; set; } + } +} \ No newline at end of file diff --git a/MvcMusicStore/Models/Artist.cs b/MvcMusicStore/Models/Artist.cs new file mode 100644 index 0000000..a03332f --- /dev/null +++ b/MvcMusicStore/Models/Artist.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace MvcMusicStore.Models +{ + public class Artist + { + public virtual int ArtistId { get; set; } + public virtual string Name { get; set; } + } +} \ No newline at end of file diff --git a/MvcMusicStore/Models/Genre.cs b/MvcMusicStore/Models/Genre.cs new file mode 100644 index 0000000..521a9ea --- /dev/null +++ b/MvcMusicStore/Models/Genre.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace MvcMusicStore.Models +{ + public class Genre + { + public virtual int GenreId { get; set; } + public virtual string Name { get; set; } + public virtual string Description { get; set; } + public virtual List Albums { get; set; } + } +} \ No newline at end of file diff --git a/MvcMusicStore/MvcMusicStore.csproj b/MvcMusicStore/MvcMusicStore.csproj index defea00..c11e3a3 100644 --- a/MvcMusicStore/MvcMusicStore.csproj +++ b/MvcMusicStore/MvcMusicStore.csproj @@ -125,6 +125,9 @@ Global.asax + + + @@ -166,7 +169,6 @@ -