diff --git a/.gitignore b/.gitignore index 35063fc..31c93bd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ ## ## Get latest from https://github.com/github/gitignore/blob/main/Dotnet.gitignore +## Ignore vs files +.vs/ + # Build results [Dd]ebug/ [Dd]ebugPublic/ diff --git a/.vs/CCMovieDatabase/CopilotIndices/17.14.1091.29919/CodeChunks.db b/.vs/CCMovieDatabase/CopilotIndices/17.14.1091.29919/CodeChunks.db deleted file mode 100644 index c9cbb4b..0000000 Binary files a/.vs/CCMovieDatabase/CopilotIndices/17.14.1091.29919/CodeChunks.db and /dev/null differ diff --git a/.vs/CCMovieDatabase/CopilotIndices/17.14.1091.29919/SemanticSymbols.db b/.vs/CCMovieDatabase/CopilotIndices/17.14.1091.29919/SemanticSymbols.db deleted file mode 100644 index e078957..0000000 Binary files a/.vs/CCMovieDatabase/CopilotIndices/17.14.1091.29919/SemanticSymbols.db and /dev/null differ diff --git a/.vs/CCMovieDatabase/DesignTimeBuild/.dtbcache.v2 b/.vs/CCMovieDatabase/DesignTimeBuild/.dtbcache.v2 deleted file mode 100644 index a6a7346..0000000 Binary files a/.vs/CCMovieDatabase/DesignTimeBuild/.dtbcache.v2 and /dev/null differ diff --git a/.vs/CCMovieDatabase/FileContentIndex/06083164-4cda-495c-8638-7422dd3c34fb.vsidx b/.vs/CCMovieDatabase/FileContentIndex/06083164-4cda-495c-8638-7422dd3c34fb.vsidx deleted file mode 100644 index e0809b6..0000000 Binary files a/.vs/CCMovieDatabase/FileContentIndex/06083164-4cda-495c-8638-7422dd3c34fb.vsidx and /dev/null differ diff --git a/.vs/CCMovieDatabase/config/applicationhost.config b/.vs/CCMovieDatabase/config/applicationhost.config deleted file mode 100644 index 269dc55..0000000 --- a/.vs/CCMovieDatabase/config/applicationhost.config +++ /dev/null @@ -1,1021 +0,0 @@ - - - - - - - - -
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.vs/CCMovieDatabase/v17/.futdcache.v2 b/.vs/CCMovieDatabase/v17/.futdcache.v2 deleted file mode 100644 index 3ddcfab..0000000 Binary files a/.vs/CCMovieDatabase/v17/.futdcache.v2 and /dev/null differ diff --git a/.vs/CCMovieDatabase/v17/.suo b/.vs/CCMovieDatabase/v17/.suo deleted file mode 100644 index d66e5fe..0000000 Binary files a/.vs/CCMovieDatabase/v17/.suo and /dev/null differ diff --git a/.vs/CCMovieDatabase/v17/DocumentLayout.backup.json b/.vs/CCMovieDatabase/v17/DocumentLayout.backup.json deleted file mode 100644 index ab47a6c..0000000 --- a/.vs/CCMovieDatabase/v17/DocumentLayout.backup.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "Version": 1, - "WorkspaceRootPath": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\", - "Documents": [ - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\controllers\\homecontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\controllers\\homecontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\shared\\_validationscriptspartial.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\shared\\_validationscriptspartial.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\shared\\_layout.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\shared\\_layout.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\home\\index.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\home\\index.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\_viewstart.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\_viewstart.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - } - ], - "DocumentGroupContainers": [ - { - "Orientation": 0, - "VerticalTabListWidth": 256, - "DocumentGroups": [ - { - "DockedWidth": 200, - "SelectedChildIndex": 5, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}" - }, - { - "$type": "Document", - "DocumentIndex": 2, - "Title": "_ValidationScriptsPartial.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:11:48.053Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "_Layout.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "ViewState": "AgIAACEAAAAAAAAAAAAAAC8AAAA5AAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:10:08.845Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 5, - "Title": "_ViewStart.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\_ViewStart.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\_ViewStart.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\_ViewStart.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\_ViewStart.cshtml", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:09:57.305Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "Index.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Home\\Index.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\Home\\Index.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Home\\Index.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\Home\\Index.cshtml", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAAGAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:09:20.725Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 0, - "Title": "Program.cs", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Program.cs", - "RelativeDocumentMoniker": "CCMovieDatabase\\Program.cs", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Program.cs", - "RelativeToolTip": "CCMovieDatabase\\Program.cs", - "ViewState": "AgIAAA0AAAAAAAAAAAAgwB0AAABCAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-10-15T18:04:16.136Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 1, - "Title": "HomeController.cs", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Controllers\\HomeController.cs", - "RelativeDocumentMoniker": "CCMovieDatabase\\Controllers\\HomeController.cs", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Controllers\\HomeController.cs", - "RelativeToolTip": "CCMovieDatabase\\Controllers\\HomeController.cs", - "ViewState": "AgIAAAgAAAAAAAAAAAAQwA8AAAAiAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-10-15T18:03:20.632Z", - "EditorCaption": "" - } - ] - }, - { - "DockedWidth": 116, - "SelectedChildIndex": -1, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{e1b7d1f8-9b3c-49b1-8f4f-bfc63a88835d}" - }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{0ad07096-bba9-4900-a651-0598d26f6d24}" - }, - { - "$type": "Bookmark", - "Name": "ST:2:0:{d212f56b-c48a-434c-a121-1c5d80b59b9f}" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/.vs/CCMovieDatabase/v17/DocumentLayout.json b/.vs/CCMovieDatabase/v17/DocumentLayout.json deleted file mode 100644 index ab47a6c..0000000 --- a/.vs/CCMovieDatabase/v17/DocumentLayout.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "Version": 1, - "WorkspaceRootPath": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\", - "Documents": [ - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\controllers\\homecontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\controllers\\homecontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\shared\\_validationscriptspartial.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\shared\\_validationscriptspartial.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\shared\\_layout.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\shared\\_layout.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\home\\index.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\home\\index.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - }, - { - "AbsoluteMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|c:\\users\\jesse.harlan\\source\\repos\\ccmoviedatabase\\ccmoviedatabase\\views\\_viewstart.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}", - "RelativeMoniker": "D:0:0:{CA95C814-1EC4-453F-A07A-58E07FBD5D00}|CCMovieDatabase\\CCMovieDatabase.csproj|solutionrelative:ccmoviedatabase\\views\\_viewstart.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}" - } - ], - "DocumentGroupContainers": [ - { - "Orientation": 0, - "VerticalTabListWidth": 256, - "DocumentGroups": [ - { - "DockedWidth": 200, - "SelectedChildIndex": 5, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}" - }, - { - "$type": "Document", - "DocumentIndex": 2, - "Title": "_ValidationScriptsPartial.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\Shared\\_ValidationScriptsPartial.cshtml", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:11:48.053Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "_Layout.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\Shared\\_Layout.cshtml", - "ViewState": "AgIAACEAAAAAAAAAAAAAAC8AAAA5AAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:10:08.845Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 5, - "Title": "_ViewStart.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\_ViewStart.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\_ViewStart.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\_ViewStart.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\_ViewStart.cshtml", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:09:57.305Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "Index.cshtml", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Home\\Index.cshtml", - "RelativeDocumentMoniker": "CCMovieDatabase\\Views\\Home\\Index.cshtml", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Views\\Home\\Index.cshtml", - "RelativeToolTip": "CCMovieDatabase\\Views\\Home\\Index.cshtml", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAAGAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|", - "WhenOpened": "2025-10-15T18:09:20.725Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 0, - "Title": "Program.cs", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Program.cs", - "RelativeDocumentMoniker": "CCMovieDatabase\\Program.cs", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Program.cs", - "RelativeToolTip": "CCMovieDatabase\\Program.cs", - "ViewState": "AgIAAA0AAAAAAAAAAAAgwB0AAABCAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-10-15T18:04:16.136Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 1, - "Title": "HomeController.cs", - "DocumentMoniker": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Controllers\\HomeController.cs", - "RelativeDocumentMoniker": "CCMovieDatabase\\Controllers\\HomeController.cs", - "ToolTip": "C:\\Users\\jesse.harlan\\source\\repos\\CCMovieDatabase\\CCMovieDatabase\\Controllers\\HomeController.cs", - "RelativeToolTip": "CCMovieDatabase\\Controllers\\HomeController.cs", - "ViewState": "AgIAAAgAAAAAAAAAAAAQwA8AAAAiAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-10-15T18:03:20.632Z", - "EditorCaption": "" - } - ] - }, - { - "DockedWidth": 116, - "SelectedChildIndex": -1, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{e1b7d1f8-9b3c-49b1-8f4f-bfc63a88835d}" - }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{0ad07096-bba9-4900-a651-0598d26f6d24}" - }, - { - "$type": "Bookmark", - "Name": "ST:2:0:{d212f56b-c48a-434c-a121-1c5d80b59b9f}" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/.vs/ProjectEvaluation/ccmoviedatabase.metadata.v9.bin b/.vs/ProjectEvaluation/ccmoviedatabase.metadata.v9.bin deleted file mode 100644 index 0db3006..0000000 Binary files a/.vs/ProjectEvaluation/ccmoviedatabase.metadata.v9.bin and /dev/null differ diff --git a/.vs/ProjectEvaluation/ccmoviedatabase.projects.v9.bin b/.vs/ProjectEvaluation/ccmoviedatabase.projects.v9.bin deleted file mode 100644 index c0daf66..0000000 Binary files a/.vs/ProjectEvaluation/ccmoviedatabase.projects.v9.bin and /dev/null differ diff --git a/.vs/ProjectEvaluation/ccmoviedatabase.strings.v9.bin b/.vs/ProjectEvaluation/ccmoviedatabase.strings.v9.bin deleted file mode 100644 index 2513863..0000000 Binary files a/.vs/ProjectEvaluation/ccmoviedatabase.strings.v9.bin and /dev/null differ diff --git a/CCMovieDatabase/CCMovieDatabase.csproj b/CCMovieDatabase/CCMovieDatabase.csproj index 6568b3d..0d1281d 100644 --- a/CCMovieDatabase/CCMovieDatabase.csproj +++ b/CCMovieDatabase/CCMovieDatabase.csproj @@ -6,4 +6,13 @@ enable + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/CCMovieDatabase/CCMovieDatabase.csproj.user b/CCMovieDatabase/CCMovieDatabase.csproj.user index 9ff5820..904fdb0 100644 --- a/CCMovieDatabase/CCMovieDatabase.csproj.user +++ b/CCMovieDatabase/CCMovieDatabase.csproj.user @@ -2,5 +2,16 @@ https + <_SelectedScaffolderID>MvcControllerWithContextScaffolder + <_SelectedScaffolderCategoryPath>root/Common + 650 + 650 + True + False + True + + CCMovieDatabase.Data.MovieContext + False + True \ No newline at end of file diff --git a/CCMovieDatabase/Controllers/BlogController.cs b/CCMovieDatabase/Controllers/BlogController.cs new file mode 100644 index 0000000..f619108 --- /dev/null +++ b/CCMovieDatabase/Controllers/BlogController.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; + +namespace CCMovieDatabase.Controllers +{ + public class BlogController : Controller + { + private readonly MovieContext _context; + + public BlogController(MovieContext context) + { + _context = context; + } + + // GET: Blog + public async Task Index() + { + return View(await _context.Articles.ToListAsync()); + } + + // GET: Blog/Details/5 + public async Task Details(int? id) + { + if (id == null) + { + return NotFound(); + } + + var article = await _context.Articles + .FirstOrDefaultAsync(m => m.ArticleId == id); + if (article == null) + { + return NotFound(); + } + + return View(article); + } + + // GET: Blog/Create + public IActionResult Create() + { + return View(); + } + + // POST: Blog/Create + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("ArticleId,Title,Body,Slug,CreatedAt,ModifiedAt,Author,ThumbnailUrl,ShortDescription,IsFeatured")] Article article) + { + if (ModelState.IsValid) + { + _context.Add(article); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + return View(article); + } + + // GET: Blog/Edit/5 + public async Task Edit(int? id) + { + if (id == null) + { + return NotFound(); + } + + var article = await _context.Articles.FindAsync(id); + if (article == null) + { + return NotFound(); + } + return View(article); + } + + // POST: Blog/Edit/5 + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("ArticleId,Title,Body,Slug,CreatedAt,ModifiedAt,Author,ThumbnailUrl,ShortDescription,IsFeatured")] Article article) + { + if (id != article.ArticleId) + { + return NotFound(); + } + + if (ModelState.IsValid) + { + try + { + _context.Update(article); + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!ArticleExists(article.ArticleId)) + { + return NotFound(); + } + else + { + throw; + } + } + return RedirectToAction(nameof(Index)); + } + return View(article); + } + + // GET: Blog/Delete/5 + public async Task Delete(int? id) + { + if (id == null) + { + return NotFound(); + } + + var article = await _context.Articles + .FirstOrDefaultAsync(m => m.ArticleId == id); + if (article == null) + { + return NotFound(); + } + + return View(article); + } + + // POST: Blog/Delete/5 + [HttpPost, ActionName("Delete")] + [ValidateAntiForgeryToken] + public async Task DeleteConfirmed(int id) + { + var article = await _context.Articles.FindAsync(id); + if (article != null) + { + _context.Articles.Remove(article); + } + + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + private bool ArticleExists(int id) + { + return _context.Articles.Any(e => e.ArticleId == id); + } + } +} diff --git a/CCMovieDatabase/Controllers/HomeController.cs b/CCMovieDatabase/Controllers/HomeController.cs index 93199ab..b72d551 100644 --- a/CCMovieDatabase/Controllers/HomeController.cs +++ b/CCMovieDatabase/Controllers/HomeController.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using CCMovieDatabase.Data; using CCMovieDatabase.Models; using Microsoft.AspNetCore.Mvc; @@ -7,15 +8,19 @@ namespace CCMovieDatabase.Controllers public class HomeController : Controller { private readonly ILogger _logger; + private readonly MovieContext _context; - public HomeController(ILogger logger) + public HomeController(ILogger logger, MovieContext context) { _logger = logger; + _context = context; } public IActionResult Index() { - return View(); + // TODO: filter the articles by IsFeatured, returning only the most recent 4 + var articles = _context.Articles.Take(4).ToList(); + return View(articles); } public IActionResult Privacy() diff --git a/CCMovieDatabase/Controllers/JesseController.cs b/CCMovieDatabase/Controllers/JesseController.cs new file mode 100644 index 0000000..d79ea8a --- /dev/null +++ b/CCMovieDatabase/Controllers/JesseController.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; + +namespace CCMovieDatabase.Controllers +{ + public class JesseController : Controller + { + private readonly MovieContext _context; + + public JesseController(MovieContext context) + { + _context = context; + } + + // GET: Jesse + public async Task Index() + { + var movieContext = _context.Movie + .Include(m => m.Rating) + .Where(m => m.Rating.Name == "G"); + return View(await movieContext.ToListAsync()); + } + + // GET: Jesse/Details/5 + public async Task Details(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // GET: Jesse/Create + public IActionResult Create() + { + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId"); + return View(); + } + + // POST: Jesse/Create + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("Id,Title,Description,ReleaseDate,RatingId")] Movie movie) + { + if (ModelState.IsValid) + { + _context.Add(movie); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: Jesse/Edit/5 + public async Task Edit(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie.FindAsync(id); + if (movie == null) + { + return NotFound(); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // POST: Jesse/Edit/5 + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("Id,Title,Description,ReleaseDate,RatingId")] Movie movie) + { + if (id != movie.Id) + { + return NotFound(); + } + + if (ModelState.IsValid) + { + try + { + _context.Update(movie); + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!MovieExists(movie.Id)) + { + return NotFound(); + } + else + { + throw; + } + } + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: Jesse/Delete/5 + public async Task Delete(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // POST: Jesse/Delete/5 + [HttpPost, ActionName("Delete")] + [ValidateAntiForgeryToken] + public async Task DeleteConfirmed(int id) + { + var movie = await _context.Movie.FindAsync(id); + if (movie != null) + { + _context.Movie.Remove(movie); + } + + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + private bool MovieExists(int id) + { + return _context.Movie.Any(e => e.Id == id); + } + } +} diff --git a/CCMovieDatabase/Controllers/MoviesApiController.cs b/CCMovieDatabase/Controllers/MoviesApiController.cs new file mode 100644 index 0000000..c1f6a8f --- /dev/null +++ b/CCMovieDatabase/Controllers/MoviesApiController.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; + +namespace CCMovieDatabase.Controllers +{ + [Route("api/movies")] + [ApiController] + public class MoviesApiController : ControllerBase + { + private readonly MovieContext _context; + + public MoviesApiController(MovieContext context) + { + _context = context; + } + + // GET: api/Movies + [HttpGet] + public async Task>> GetMovie() + { + return await _context.Movie.ToListAsync(); + } + + // GET: api/Movies/5 + [HttpGet("{id}")] + public async Task> GetMovie(int id) + { + var movie = await _context.Movie.FindAsync(id); + + if (movie == null) + { + return NotFound(); + } + + return movie; + } + + // PUT: api/Movies/5 + // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754 + [HttpPut("{id}")] + public async Task PutMovie(int id, Movie movie) + { + if (id != movie.Id) + { + return BadRequest(); + } + + _context.Entry(movie).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!MovieExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return NoContent(); + } + + // POST: api/Movies + // To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754 + [HttpPost] + public async Task> PostMovie(Movie movie) + { + _context.Movie.Add(movie); + await _context.SaveChangesAsync(); + + return CreatedAtAction("GetMovie", new { id = movie.Id }, movie); + } + + // DELETE: api/Movies/5 + [HttpDelete("{id}")] + public async Task DeleteMovie(int id) + { + var movie = await _context.Movie.FindAsync(id); + if (movie == null) + { + return NotFound(); + } + + _context.Movie.Remove(movie); + await _context.SaveChangesAsync(); + + return NoContent(); + } + + private bool MovieExists(int id) + { + return _context.Movie.Any(e => e.Id == id); + } + } +} diff --git a/CCMovieDatabase/Controllers/MoviesController.cs b/CCMovieDatabase/Controllers/MoviesController.cs new file mode 100644 index 0000000..4ec3a56 --- /dev/null +++ b/CCMovieDatabase/Controllers/MoviesController.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; + +namespace CCMovieDatabase.Controllers +{ + public class MoviesController : Controller + { + private readonly MovieContext _context; + + public MoviesController(MovieContext context) + { + _context = context; + } + + // GET: Movies + public async Task Index() + { + var movieContext = _context.Movie.Include(m => m.Rating); + return View(await movieContext.ToListAsync()); + } + + // GET: Movies/Details/5 + public async Task Details(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // GET: Movies/Create + public IActionResult Create() + { + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId"); + return View(); + } + + // POST: Movies/Create + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("Id,Title,Description,ReleaseDate,RatingId,ThumbnailURL")] Movie movie) + { + if (ModelState.IsValid) + { + _context.Add(movie); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: Movies/Edit/5 + public async Task Edit(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie.FindAsync(id); + if (movie == null) + { + return NotFound(); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // POST: Movies/Edit/5 + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("Id,Title,Description,ReleaseDate,RatingId,ThumbnailURL")] Movie movie) + { + if (id != movie.Id) + { + return NotFound(); + } + + if (ModelState.IsValid) + { + try + { + _context.Update(movie); + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!MovieExists(movie.Id)) + { + return NotFound(); + } + else + { + throw; + } + } + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: Movies/Delete/5 + public async Task Delete(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // POST: Movies/Delete/5 + [HttpPost, ActionName("Delete")] + [ValidateAntiForgeryToken] + public async Task DeleteConfirmed(int id) + { + var movie = await _context.Movie.FindAsync(id); + if (movie != null) + { + _context.Movie.Remove(movie); + } + + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + private bool MovieExists(int id) + { + return _context.Movie.Any(e => e.Id == id); + } + } +} diff --git a/CCMovieDatabase/Controllers/PorterListController.cs b/CCMovieDatabase/Controllers/PorterListController.cs new file mode 100644 index 0000000..9eb321d --- /dev/null +++ b/CCMovieDatabase/Controllers/PorterListController.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; + +namespace CCMovieDatabase.Controllers +{ + public class PorterListController : Controller + { + private readonly MovieContext _context; + + public PorterListController(MovieContext context) + { + _context = context; + } + + // GET: PorterList + public async Task Index() + { + var movieContext = _context.Movie + .Include(m => m.Rating) + .Skip(2) + .Take(5); + return View(await movieContext.ToListAsync()); + } + + // GET: PorterList/Details/5 + public async Task Details(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // GET: PorterList/Create + public IActionResult Create() + { + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId"); + return View(); + } + + // POST: PorterList/Create + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("Id,Title,Description,ReleaseDate,RatingId,ThumbnailURL")] Movie movie) + { + if (ModelState.IsValid) + { + _context.Add(movie); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: PorterList/Edit/5 + public async Task Edit(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie.FindAsync(id); + if (movie == null) + { + return NotFound(); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // POST: PorterList/Edit/5 + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("Id,Title,Description,ReleaseDate,RatingId,ThumbnailURL")] Movie movie) + { + if (id != movie.Id) + { + return NotFound(); + } + + if (ModelState.IsValid) + { + try + { + _context.Update(movie); + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!MovieExists(movie.Id)) + { + return NotFound(); + } + else + { + throw; + } + } + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: PorterList/Delete/5 + public async Task Delete(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // POST: PorterList/Delete/5 + [HttpPost, ActionName("Delete")] + [ValidateAntiForgeryToken] + public async Task DeleteConfirmed(int id) + { + var movie = await _context.Movie.FindAsync(id); + if (movie != null) + { + _context.Movie.Remove(movie); + } + + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + private bool MovieExists(int id) + { + return _context.Movie.Any(e => e.Id == id); + } + } +} diff --git a/CCMovieDatabase/Data/MovieContext.cs b/CCMovieDatabase/Data/MovieContext.cs new file mode 100644 index 0000000..e9efe10 --- /dev/null +++ b/CCMovieDatabase/Data/MovieContext.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Models; +using System.Reflection; + +namespace CCMovieDatabase.Data +{ + public class MovieContext : DbContext + { + public MovieContext (DbContextOptions options) + : base(options) + { + } + + public DbSet Movie { get; set; } = default!; + public DbSet Ratings { get; set; } = default!; + public DbSet ActingCredits { get; set; } = default!; + public DbSet CrewCredits { get; set; } = default!; + public DbSet
Articles { get; set; } = default!; + public DbSet Characters { get; set; } = default!; + public DbSet Persons { get; set; } = default!; + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + var ratings = new List + { + new Rating { RatingId = 1, Name = "PG-13" }, + new Rating { RatingId = 2, Name = "R" }, + new Rating { RatingId = 3, Name = "G" }, + new Rating { RatingId = 4, Name = "PG" } + }; + modelBuilder.Entity().HasData(ratings); + + // right here we seed data + var movies = new List + { + new Movie { Id = 1, Title = "Shrek", ReleaseDate = new DateOnly(2001, 04, 26), Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", RatingId = 1, ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd" }, + new Movie { Id = 2, Title = "Shrek 2", ReleaseDate = new DateOnly(2002, 04, 26), Description = "Shrek is back baby!", RatingId = 1, ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS" }, + new Movie { Id = 3, Title = "Harry Potter and the Sorcerer's Stone", ReleaseDate = new DateOnly(2001,01,01), Description = "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", RatingId = 4, ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQcZT3sdwr1NiJytvJb95icJJKPWpWRNv35l_uuVYxjlzBJS-hb" }, + new Movie { Id = 4, Title = "Toy Story", ReleaseDate = new DateOnly(1995,01,01), Description = "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", RatingId = 3, ThumbnailURL = "https://m.media-amazon.com/images/M/MV5BZTA3OWVjOWItNjE1NS00NzZiLWE1MjgtZDZhMWI1ZTlkNzYwXkEyXkFqcGc@._V1_.jpg" }, + new Movie { Id = 5, Title = "A Christmas Story", ReleaseDate = new DateOnly(1983,01,01), Description = "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", RatingId = 4, ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUZk92ju8kisZKCc9m4lyySg9S5RSM6mhFnSWOpOb1_MlCsHsw" }, + new Movie { Id = 6, Title = "Elf", ReleaseDate = new DateOnly(2003,01,01), Description = "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", RatingId = 4, ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT08ZFpbAwAL_jQFtQfMjut1_T6oNgxRCQiOPA6S1twJLXZq_Wi" }, + new Movie { Id = 7, Title = "Weapons", ReleaseDate = new DateOnly(2025,01,01), Description = "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", RatingId = 2, ThumbnailURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR84Bm2XnTfW7hukdkEdr5jezVGfoIt22h0-s7Dfk1aRavoPZmh" } + + }; + + modelBuilder.Entity().HasData(movies); + + // article seed data + var articles = new List
+ { + new Article { ArticleId = 1, Title = "Welcome to CCMovieDatabase", Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", Slug = "hello_world", CreatedAt = new DateTime(2025, 11, 12), ModifiedAt = new DateTime(2025, 11, 12), Author = "Jesse", ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", ShortDescription = "Lorem Ipsum and stuff", IsFeatured = true }, + new Article { ArticleId = 2, Title = "More Movies Added", Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", Slug = "hello_world2", CreatedAt = new DateTime(2025, 11, 12), ModifiedAt = new DateTime(2025, 11, 12), Author = "Jesse", ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", ShortDescription = "Lorem Ipsum and stuff", IsFeatured = true }, + new Article { ArticleId = 3, Title = "For the love of movies", Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", Slug = "hello_world3", CreatedAt = new DateTime(2025, 11, 12), ModifiedAt = new DateTime(2025, 11, 12), Author = "Jesse", ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", ShortDescription = "Lorem Ipsum and stuff", IsFeatured = true }, + new Article { ArticleId = 4, Title = "I wrote this", Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", Slug = "hello_world4", CreatedAt = new DateTime(2025, 11, 12), ModifiedAt = new DateTime(2025, 11, 12), Author = "Jesse", ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", ShortDescription = "Lorem Ipsum and stuff", IsFeatured = true }, + }; + + modelBuilder.Entity
().HasData(articles); + + } + } +} diff --git a/CCMovieDatabase/Migrations/20251020182703_InitialMovieTable.Designer.cs b/CCMovieDatabase/Migrations/20251020182703_InitialMovieTable.Designer.cs new file mode 100644 index 0000000..6de732e --- /dev/null +++ b/CCMovieDatabase/Migrations/20251020182703_InitialMovieTable.Designer.cs @@ -0,0 +1,58 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251020182703_InitialMovieTable")] + partial class InitialMovieTable + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MotionPictureRating") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Movie"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251020182703_InitialMovieTable.cs b/CCMovieDatabase/Migrations/20251020182703_InitialMovieTable.cs new file mode 100644 index 0000000..ebea516 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251020182703_InitialMovieTable.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class InitialMovieTable : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Movie", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: false), + MotionPictureRating = table.Column(type: "nvarchar(max)", nullable: false), + ReleaseDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Movie", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Movie"); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251022173250_NullableDescription.Designer.cs b/CCMovieDatabase/Migrations/20251022173250_NullableDescription.Designer.cs new file mode 100644 index 0000000..08e0113 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251022173250_NullableDescription.Designer.cs @@ -0,0 +1,57 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251022173250_NullableDescription")] + partial class NullableDescription + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MotionPictureRating") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Movie"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251022173250_NullableDescription.cs b/CCMovieDatabase/Migrations/20251022173250_NullableDescription.cs new file mode 100644 index 0000000..54fdb6a --- /dev/null +++ b/CCMovieDatabase/Migrations/20251022173250_NullableDescription.cs @@ -0,0 +1,36 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class NullableDescription : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Description", + table: "Movie", + type: "nvarchar(max)", + nullable: true, + oldClrType: typeof(string), + oldType: "nvarchar(max)"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Description", + table: "Movie", + type: "nvarchar(max)", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "nvarchar(max)", + oldNullable: true); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251027175805_AddedSeedData.Designer.cs b/CCMovieDatabase/Migrations/20251027175805_AddedSeedData.Designer.cs new file mode 100644 index 0000000..b9178ea --- /dev/null +++ b/CCMovieDatabase/Migrations/20251027175805_AddedSeedData.Designer.cs @@ -0,0 +1,67 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251027175805_AddedSeedData")] + partial class AddedSeedData + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MotionPictureRating") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A Movie about a big green loudmouth.", + MotionPictureRating = "PG", + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251027175805_AddedSeedData.cs b/CCMovieDatabase/Migrations/20251027175805_AddedSeedData.cs new file mode 100644 index 0000000..4c7b3d1 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251027175805_AddedSeedData.cs @@ -0,0 +1,29 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedSeedData : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Movie", + columns: new[] { "Id", "Description", "MotionPictureRating", "ReleaseDate", "Title" }, + values: new object[] { 1, "A Movie about a big green loudmouth.", "PG", new DateOnly(2001, 4, 26), "Shrek" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 1); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251027180626_UpdatedShrek.Designer.cs b/CCMovieDatabase/Migrations/20251027180626_UpdatedShrek.Designer.cs new file mode 100644 index 0000000..02ae276 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251027180626_UpdatedShrek.Designer.cs @@ -0,0 +1,67 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251027180626_UpdatedShrek")] + partial class UpdatedShrek + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MotionPictureRating") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + MotionPictureRating = "PG", + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251027180626_UpdatedShrek.cs b/CCMovieDatabase/Migrations/20251027180626_UpdatedShrek.cs new file mode 100644 index 0000000..0ab1606 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251027180626_UpdatedShrek.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class UpdatedShrek : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 1, + column: "Description", + value: "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back."); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 1, + column: "Description", + value: "A Movie about a big green loudmouth."); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251028182246_AddedRatings.Designer.cs b/CCMovieDatabase/Migrations/20251028182246_AddedRatings.Designer.cs new file mode 100644 index 0000000..be6f1b9 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251028182246_AddedRatings.Designer.cs @@ -0,0 +1,116 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251028182246_AddedRatings")] + partial class AddedRatings + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251028182246_AddedRatings.cs b/CCMovieDatabase/Migrations/20251028182246_AddedRatings.cs new file mode 100644 index 0000000..4591065 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251028182246_AddedRatings.cs @@ -0,0 +1,113 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedRatings : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "MotionPictureRating", + table: "Movie"); + + migrationBuilder.AddColumn( + name: "RatingId", + table: "Movie", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "Ratings", + columns: table => new + { + RatingId = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Ratings", x => x.RatingId); + }); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 1, + column: "RatingId", + value: 1); + + migrationBuilder.InsertData( + table: "Ratings", + columns: new[] { "RatingId", "Name" }, + values: new object[,] + { + { 1, "PG-13" }, + { 2, "R" } + }); + + migrationBuilder.InsertData( + table: "Movie", + columns: new[] { "Id", "Description", "RatingId", "ReleaseDate", "Title" }, + values: new object[] { 2, "Shrek is back baby!", 1, new DateOnly(2002, 4, 26), "Shrek 2" }); + + migrationBuilder.CreateIndex( + name: "IX_Movie_RatingId", + table: "Movie", + column: "RatingId"); + + migrationBuilder.AddForeignKey( + name: "FK_Movie_Ratings_RatingId", + table: "Movie", + column: "RatingId", + principalTable: "Ratings", + principalColumn: "RatingId", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Movie_Ratings_RatingId", + table: "Movie"); + + migrationBuilder.DropTable( + name: "Ratings"); + + migrationBuilder.DropIndex( + name: "IX_Movie_RatingId", + table: "Movie"); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 2); + + migrationBuilder.DropColumn( + name: "RatingId", + table: "Movie"); + + migrationBuilder.AddColumn( + name: "MotionPictureRating", + table: "Movie", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 1, + column: "MotionPictureRating", + value: "PG"); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251029173631_AddedGRating.Designer.cs b/CCMovieDatabase/Migrations/20251029173631_AddedGRating.Designer.cs new file mode 100644 index 0000000..5683d9b --- /dev/null +++ b/CCMovieDatabase/Migrations/20251029173631_AddedGRating.Designer.cs @@ -0,0 +1,121 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251029173631_AddedGRating")] + partial class AddedGRating + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251029173631_AddedGRating.cs b/CCMovieDatabase/Migrations/20251029173631_AddedGRating.cs new file mode 100644 index 0000000..8407803 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251029173631_AddedGRating.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedGRating : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Ratings", + columns: new[] { "RatingId", "Name" }, + values: new object[] { 3, "G" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Ratings", + keyColumn: "RatingId", + keyValue: 3); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251104185332_AddedTables.Designer.cs b/CCMovieDatabase/Migrations/20251104185332_AddedTables.Designer.cs new file mode 100644 index 0000000..e4fd081 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251104185332_AddedTables.Designer.cs @@ -0,0 +1,312 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251104185332_AddedTables")] + partial class AddedTables + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251104185332_AddedTables.cs b/CCMovieDatabase/Migrations/20251104185332_AddedTables.cs new file mode 100644 index 0000000..0370af7 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251104185332_AddedTables.cs @@ -0,0 +1,165 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedTables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Articles", + columns: table => new + { + ArticleId = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(max)", nullable: false), + Body = table.Column(type: "nvarchar(max)", nullable: false), + Slug = table.Column(type: "nvarchar(max)", nullable: false), + CreatedAt = table.Column(type: "datetime2", nullable: false), + ModifiedAt = table.Column(type: "datetime2", nullable: false), + Author = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Articles", x => x.ArticleId); + }); + + migrationBuilder.CreateTable( + name: "Characters", + columns: table => new + { + CharacterId = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + MovieId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Characters", x => x.CharacterId); + table.ForeignKey( + name: "FK_Characters_Movie_MovieId", + column: x => x.MovieId, + principalTable: "Movie", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Persons", + columns: table => new + { + PersonId = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FirstName = table.Column(type: "nvarchar(max)", nullable: false), + LastName = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Persons", x => x.PersonId); + }); + + migrationBuilder.CreateTable( + name: "ActingCredits", + columns: table => new + { + ActingCreditId = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PersonId = table.Column(type: "int", nullable: false), + CharacterId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ActingCredits", x => x.ActingCreditId); + table.ForeignKey( + name: "FK_ActingCredits_Characters_CharacterId", + column: x => x.CharacterId, + principalTable: "Characters", + principalColumn: "CharacterId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ActingCredits_Persons_PersonId", + column: x => x.PersonId, + principalTable: "Persons", + principalColumn: "PersonId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CrewCredits", + columns: table => new + { + CrewCreditId = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PersonId = table.Column(type: "int", nullable: false), + MovieId = table.Column(type: "int", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CrewCredits", x => x.CrewCreditId); + table.ForeignKey( + name: "FK_CrewCredits_Movie_MovieId", + column: x => x.MovieId, + principalTable: "Movie", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CrewCredits_Persons_PersonId", + column: x => x.PersonId, + principalTable: "Persons", + principalColumn: "PersonId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_ActingCredits_CharacterId", + table: "ActingCredits", + column: "CharacterId"); + + migrationBuilder.CreateIndex( + name: "IX_ActingCredits_PersonId", + table: "ActingCredits", + column: "PersonId"); + + migrationBuilder.CreateIndex( + name: "IX_Characters_MovieId", + table: "Characters", + column: "MovieId"); + + migrationBuilder.CreateIndex( + name: "IX_CrewCredits_MovieId", + table: "CrewCredits", + column: "MovieId"); + + migrationBuilder.CreateIndex( + name: "IX_CrewCredits_PersonId", + table: "CrewCredits", + column: "PersonId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ActingCredits"); + + migrationBuilder.DropTable( + name: "Articles"); + + migrationBuilder.DropTable( + name: "CrewCredits"); + + migrationBuilder.DropTable( + name: "Characters"); + + migrationBuilder.DropTable( + name: "Persons"); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251106190510_AddedThumbnails.Designer.cs b/CCMovieDatabase/Migrations/20251106190510_AddedThumbnails.Designer.cs new file mode 100644 index 0000000..318b674 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251106190510_AddedThumbnails.Designer.cs @@ -0,0 +1,315 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251106190510_AddedThumbnails")] + partial class AddedThumbnails + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251106190510_AddedThumbnails.cs b/CCMovieDatabase/Migrations/20251106190510_AddedThumbnails.cs new file mode 100644 index 0000000..aa0cbad --- /dev/null +++ b/CCMovieDatabase/Migrations/20251106190510_AddedThumbnails.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedThumbnails : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ThumbnailUrl", + table: "Articles", + type: "nvarchar(max)", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ThumbnailUrl", + table: "Articles"); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251106191449_AddedArticleProps.Designer.cs b/CCMovieDatabase/Migrations/20251106191449_AddedArticleProps.Designer.cs new file mode 100644 index 0000000..8891fde --- /dev/null +++ b/CCMovieDatabase/Migrations/20251106191449_AddedArticleProps.Designer.cs @@ -0,0 +1,322 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251106191449_AddedArticleProps")] + partial class AddedArticleProps + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251106191449_AddedArticleProps.cs b/CCMovieDatabase/Migrations/20251106191449_AddedArticleProps.cs new file mode 100644 index 0000000..08b2e77 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251106191449_AddedArticleProps.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedArticleProps : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsFeatured", + table: "Articles", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ShortDescription", + table: "Articles", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsFeatured", + table: "Articles"); + + migrationBuilder.DropColumn( + name: "ShortDescription", + table: "Articles"); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251112190255_AddedArticles.Designer.cs b/CCMovieDatabase/Migrations/20251112190255_AddedArticles.Designer.cs new file mode 100644 index 0000000..9216173 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251112190255_AddedArticles.Designer.cs @@ -0,0 +1,376 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251112190255_AddedArticles")] + partial class AddedArticles + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251112190255_AddedArticles.cs b/CCMovieDatabase/Migrations/20251112190255_AddedArticles.cs new file mode 100644 index 0000000..d3fae97 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251112190255_AddedArticles.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedArticles : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Articles", + columns: new[] { "ArticleId", "Author", "Body", "CreatedAt", "IsFeatured", "ModifiedAt", "ShortDescription", "Slug", "ThumbnailUrl", "Title" }, + values: new object[,] + { + { 1, "Jesse", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), true, new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lorem Ipsum and stuff", "hello_world", "https://craftypixels.com/placeholder-image/300", "Welcome to CCMovieDatabase" }, + { 2, "Jesse", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), true, new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lorem Ipsum and stuff", "hello_world2", "https://craftypixels.com/placeholder-image/300", "More Movies Added" }, + { 3, "Jesse", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), true, new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lorem Ipsum and stuff", "hello_world3", "https://craftypixels.com/placeholder-image/300", "For the love of movies" }, + { 4, "Jesse", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), true, new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lorem Ipsum and stuff", "hello_world4", "https://craftypixels.com/placeholder-image/300", "I wrote this" } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Articles", + keyColumn: "ArticleId", + keyValue: 1); + + migrationBuilder.DeleteData( + table: "Articles", + keyColumn: "ArticleId", + keyValue: 2); + + migrationBuilder.DeleteData( + table: "Articles", + keyColumn: "ArticleId", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "Articles", + keyColumn: "ArticleId", + keyValue: 4); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251201191148_AddedSeededMoviesForTop5.Designer.cs b/CCMovieDatabase/Migrations/20251201191148_AddedSeededMoviesForTop5.Designer.cs new file mode 100644 index 0000000..a9985aa --- /dev/null +++ b/CCMovieDatabase/Migrations/20251201191148_AddedSeededMoviesForTop5.Designer.cs @@ -0,0 +1,416 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251201191148_AddedSeededMoviesForTop5")] + partial class AddedSeededMoviesForTop5 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 1, 1), + Title = "Harry Potter and the Sorcerer's Stone" + }, + new + { + Id = 4, + Description = "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", + RatingId = 3, + ReleaseDate = new DateOnly(1995, 1, 1), + Title = "Toy Story" + }, + new + { + Id = 5, + Description = "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", + RatingId = 1, + ReleaseDate = new DateOnly(1983, 1, 1), + Title = "A Christmas Story" + }, + new + { + Id = 6, + Description = "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", + RatingId = 1, + ReleaseDate = new DateOnly(2003, 1, 1), + Title = "Elf" + }, + new + { + Id = 7, + Description = "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", + RatingId = 2, + ReleaseDate = new DateOnly(2025, 1, 1), + Title = "Weapons" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251201191148_AddedSeededMoviesForTop5.cs b/CCMovieDatabase/Migrations/20251201191148_AddedSeededMoviesForTop5.cs new file mode 100644 index 0000000..cb58d1f --- /dev/null +++ b/CCMovieDatabase/Migrations/20251201191148_AddedSeededMoviesForTop5.cs @@ -0,0 +1,58 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedSeededMoviesForTop5 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Movie", + columns: new[] { "Id", "Description", "RatingId", "ReleaseDate", "Title" }, + values: new object[,] + { + { 3, "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", 1, new DateOnly(2001, 1, 1), "Harry Potter and the Sorcerer's Stone" }, + { 4, "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", 3, new DateOnly(1995, 1, 1), "Toy Story" }, + { 5, "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", 1, new DateOnly(1983, 1, 1), "A Christmas Story" }, + { 6, "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", 1, new DateOnly(2003, 1, 1), "Elf" }, + { 7, "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", 2, new DateOnly(2025, 1, 1), "Weapons" } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 4); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 5); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 6); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 7); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251202193443_AddedPGRating.Designer.cs b/CCMovieDatabase/Migrations/20251202193443_AddedPGRating.Designer.cs new file mode 100644 index 0000000..ba36fbd --- /dev/null +++ b/CCMovieDatabase/Migrations/20251202193443_AddedPGRating.Designer.cs @@ -0,0 +1,431 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251202193443_AddedPGRating")] + partial class AddedPGRating + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ThumbnailURL") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd", + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQcZT3sdwr1NiJytvJb95icJJKPWpWRNv35l_uuVYxjlzBJS-hb", + Title = "Harry Potter and the Sorcerer's Stone" + }, + new + { + Id = 4, + Description = "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", + RatingId = 3, + ReleaseDate = new DateOnly(1995, 1, 1), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRw1ynxwA6p8jGMs5TD1Q6BFgn9fafEk-XQ3lrYQGQo0q4Ggo3a", + Title = "Toy Story" + }, + new + { + Id = 5, + Description = "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", + RatingId = 1, + ReleaseDate = new DateOnly(1983, 1, 1), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUZk92ju8kisZKCc9m4lyySg9S5RSM6mhFnSWOpOb1_MlCsHsw", + Title = "A Christmas Story" + }, + new + { + Id = 6, + Description = "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", + RatingId = 1, + ReleaseDate = new DateOnly(2003, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT08ZFpbAwAL_jQFtQfMjut1_T6oNgxRCQiOPA6S1twJLXZq_Wi", + Title = "Elf" + }, + new + { + Id = 7, + Description = "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", + RatingId = 2, + ReleaseDate = new DateOnly(2025, 1, 1), + ThumbnailURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR84Bm2XnTfW7hukdkEdr5jezVGfoIt22h0-s7Dfk1aRavoPZmh", + Title = "Weapons" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251202193443_AddedPGRating.cs b/CCMovieDatabase/Migrations/20251202193443_AddedPGRating.cs new file mode 100644 index 0000000..5ec3f23 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251202193443_AddedPGRating.cs @@ -0,0 +1,87 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedPGRating : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ThumbnailURL", + table: "Movie", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 1, + column: "ThumbnailURL", + value: "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 2, + column: "ThumbnailURL", + value: "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 3, + column: "ThumbnailURL", + value: "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQcZT3sdwr1NiJytvJb95icJJKPWpWRNv35l_uuVYxjlzBJS-hb"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 4, + column: "ThumbnailURL", + value: "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRw1ynxwA6p8jGMs5TD1Q6BFgn9fafEk-XQ3lrYQGQo0q4Ggo3a"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 5, + column: "ThumbnailURL", + value: "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUZk92ju8kisZKCc9m4lyySg9S5RSM6mhFnSWOpOb1_MlCsHsw"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 6, + column: "ThumbnailURL", + value: "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT08ZFpbAwAL_jQFtQfMjut1_T6oNgxRCQiOPA6S1twJLXZq_Wi"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 7, + column: "ThumbnailURL", + value: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR84Bm2XnTfW7hukdkEdr5jezVGfoIt22h0-s7Dfk1aRavoPZmh"); + + migrationBuilder.InsertData( + table: "Ratings", + columns: new[] { "RatingId", "Name" }, + values: new object[] { 4, "PG" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Ratings", + keyColumn: "RatingId", + keyValue: 4); + + migrationBuilder.DropColumn( + name: "ThumbnailURL", + table: "Movie"); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251202193547_ModifiedMovieRatings.Designer.cs b/CCMovieDatabase/Migrations/20251202193547_ModifiedMovieRatings.Designer.cs new file mode 100644 index 0000000..b18701d --- /dev/null +++ b/CCMovieDatabase/Migrations/20251202193547_ModifiedMovieRatings.Designer.cs @@ -0,0 +1,431 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251202193547_ModifiedMovieRatings")] + partial class ModifiedMovieRatings + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ThumbnailURL") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd", + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", + RatingId = 4, + ReleaseDate = new DateOnly(2001, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQcZT3sdwr1NiJytvJb95icJJKPWpWRNv35l_uuVYxjlzBJS-hb", + Title = "Harry Potter and the Sorcerer's Stone" + }, + new + { + Id = 4, + Description = "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", + RatingId = 3, + ReleaseDate = new DateOnly(1995, 1, 1), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRw1ynxwA6p8jGMs5TD1Q6BFgn9fafEk-XQ3lrYQGQo0q4Ggo3a", + Title = "Toy Story" + }, + new + { + Id = 5, + Description = "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", + RatingId = 4, + ReleaseDate = new DateOnly(1983, 1, 1), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUZk92ju8kisZKCc9m4lyySg9S5RSM6mhFnSWOpOb1_MlCsHsw", + Title = "A Christmas Story" + }, + new + { + Id = 6, + Description = "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", + RatingId = 4, + ReleaseDate = new DateOnly(2003, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT08ZFpbAwAL_jQFtQfMjut1_T6oNgxRCQiOPA6S1twJLXZq_Wi", + Title = "Elf" + }, + new + { + Id = 7, + Description = "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", + RatingId = 2, + ReleaseDate = new DateOnly(2025, 1, 1), + ThumbnailURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR84Bm2XnTfW7hukdkEdr5jezVGfoIt22h0-s7Dfk1aRavoPZmh", + Title = "Weapons" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251202193547_ModifiedMovieRatings.cs b/CCMovieDatabase/Migrations/20251202193547_ModifiedMovieRatings.cs new file mode 100644 index 0000000..2599cd7 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251202193547_ModifiedMovieRatings.cs @@ -0,0 +1,60 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class ModifiedMovieRatings : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 3, + column: "RatingId", + value: 4); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 5, + column: "RatingId", + value: 4); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 6, + column: "RatingId", + value: 4); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 3, + column: "RatingId", + value: 1); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 5, + column: "RatingId", + value: 1); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 6, + column: "RatingId", + value: 1); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251203190234_ChangedToyStoryURL.Designer.cs b/CCMovieDatabase/Migrations/20251203190234_ChangedToyStoryURL.Designer.cs new file mode 100644 index 0000000..7c3ad97 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251203190234_ChangedToyStoryURL.Designer.cs @@ -0,0 +1,431 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251203190234_ChangedToyStoryURL")] + partial class ChangedToyStoryURL + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ThumbnailURL") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd", + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", + RatingId = 4, + ReleaseDate = new DateOnly(2001, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQcZT3sdwr1NiJytvJb95icJJKPWpWRNv35l_uuVYxjlzBJS-hb", + Title = "Harry Potter and the Sorcerer's Stone" + }, + new + { + Id = 4, + Description = "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", + RatingId = 3, + ReleaseDate = new DateOnly(1995, 1, 1), + ThumbnailURL = "https://m.media-amazon.com/images/M/MV5BZTA3OWVjOWItNjE1NS00NzZiLWE1MjgtZDZhMWI1ZTlkNzYwXkEyXkFqcGc@._V1_.jpg", + Title = "Toy Story" + }, + new + { + Id = 5, + Description = "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", + RatingId = 4, + ReleaseDate = new DateOnly(1983, 1, 1), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUZk92ju8kisZKCc9m4lyySg9S5RSM6mhFnSWOpOb1_MlCsHsw", + Title = "A Christmas Story" + }, + new + { + Id = 6, + Description = "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", + RatingId = 4, + ReleaseDate = new DateOnly(2003, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT08ZFpbAwAL_jQFtQfMjut1_T6oNgxRCQiOPA6S1twJLXZq_Wi", + Title = "Elf" + }, + new + { + Id = 7, + Description = "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", + RatingId = 2, + ReleaseDate = new DateOnly(2025, 1, 1), + ThumbnailURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR84Bm2XnTfW7hukdkEdr5jezVGfoIt22h0-s7Dfk1aRavoPZmh", + Title = "Weapons" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251203190234_ChangedToyStoryURL.cs b/CCMovieDatabase/Migrations/20251203190234_ChangedToyStoryURL.cs new file mode 100644 index 0000000..0bf3790 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251203190234_ChangedToyStoryURL.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class ChangedToyStoryURL : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 4, + column: "ThumbnailURL", + value: "https://m.media-amazon.com/images/M/MV5BZTA3OWVjOWItNjE1NS00NzZiLWE1MjgtZDZhMWI1ZTlkNzYwXkEyXkFqcGc@._V1_.jpg"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 4, + column: "ThumbnailURL", + value: "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRw1ynxwA6p8jGMs5TD1Q6BFgn9fafEk-XQ3lrYQGQo0q4Ggo3a"); + } + } +} diff --git a/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs b/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs new file mode 100644 index 0000000..3fa59ca --- /dev/null +++ b/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs @@ -0,0 +1,428 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + partial class MovieContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ThumbnailURL") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd", + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "An orphaned boy enrolls in a school of wizardry, where he learns the truth about himself, his family and the terrible evil that haunts the magical world.", + RatingId = 4, + ReleaseDate = new DateOnly(2001, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQcZT3sdwr1NiJytvJb95icJJKPWpWRNv35l_uuVYxjlzBJS-hb", + Title = "Harry Potter and the Sorcerer's Stone" + }, + new + { + Id = 4, + Description = "A cowboy doll is profoundly jealous when a new spaceman action figure supplants him as the top toy in a boy's bedroom.", + RatingId = 3, + ReleaseDate = new DateOnly(1995, 1, 1), + ThumbnailURL = "https://m.media-amazon.com/images/M/MV5BZTA3OWVjOWItNjE1NS00NzZiLWE1MjgtZDZhMWI1ZTlkNzYwXkEyXkFqcGc@._V1_.jpg", + Title = "Toy Story" + }, + new + { + Id = 5, + Description = "In the 1940s, a young boy named Ralphie Parker attempts to convince his parents, teacher, and Santa Claus that a Red Ryder Range 200 Shot BB gun really is the perfect Christmas gift.", + RatingId = 4, + ReleaseDate = new DateOnly(1983, 1, 1), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUZk92ju8kisZKCc9m4lyySg9S5RSM6mhFnSWOpOb1_MlCsHsw", + Title = "A Christmas Story" + }, + new + { + Id = 6, + Description = "Raised as an oversized elf, Buddy travels from the North Pole to New York City to meet his biological father, Walter Hobbs, who doesn't know he exists and is in desperate need of some Christmas spirit.", + RatingId = 4, + ReleaseDate = new DateOnly(2003, 1, 1), + ThumbnailURL = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT08ZFpbAwAL_jQFtQfMjut1_T6oNgxRCQiOPA6S1twJLXZq_Wi", + Title = "Elf" + }, + new + { + Id = 7, + Description = "When all but one child from the same class mysteriously vanish on the same night at exactly the same time, a community is left questioning who or what is behind their disappearance.", + RatingId = 2, + ReleaseDate = new DateOnly(2025, 1, 1), + ThumbnailURL = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR84Bm2XnTfW7hukdkEdr5jezVGfoIt22h0-s7Dfk1aRavoPZmh", + Title = "Weapons" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Models/ActingCredit.cs b/CCMovieDatabase/Models/ActingCredit.cs new file mode 100644 index 0000000..ab77bbf --- /dev/null +++ b/CCMovieDatabase/Models/ActingCredit.cs @@ -0,0 +1,13 @@ +namespace CCMovieDatabase.Models +{ + public class ActingCredit + { + public int ActingCreditId { get; set; } + public int PersonId { get; set; } + public int CharacterId { get; set; } + + // navigation properties + public Person Person { get; set; } + public Character Character { get; set; } + } +} diff --git a/CCMovieDatabase/Models/Article.cs b/CCMovieDatabase/Models/Article.cs new file mode 100644 index 0000000..35e89b5 --- /dev/null +++ b/CCMovieDatabase/Models/Article.cs @@ -0,0 +1,17 @@ +namespace CCMovieDatabase.Models +{ + public class Article + { + public int ArticleId { get; set; } + public string Title { get; set; } + public string Body { get; set; } + public string Slug { get; set; } + public DateTime CreatedAt { get; set; } + public DateTime ModifiedAt { get; set; } + public string Author { get; set; } + + public string? ThumbnailUrl { get; set; } + public string ShortDescription { get; set; } + public bool IsFeatured { get; set; } + } +} diff --git a/CCMovieDatabase/Models/Character.cs b/CCMovieDatabase/Models/Character.cs new file mode 100644 index 0000000..541c600 --- /dev/null +++ b/CCMovieDatabase/Models/Character.cs @@ -0,0 +1,12 @@ +namespace CCMovieDatabase.Models +{ + public class Character + { + public int CharacterId { get; set; } + public string Name { get; set; } + public string? Description { get; set; } + + public int MovieId { get; set; } + public Movie Movie { get; set; } + } +} diff --git a/CCMovieDatabase/Models/CrewCredit.cs b/CCMovieDatabase/Models/CrewCredit.cs new file mode 100644 index 0000000..47deb28 --- /dev/null +++ b/CCMovieDatabase/Models/CrewCredit.cs @@ -0,0 +1,14 @@ +namespace CCMovieDatabase.Models +{ + public class CrewCredit + { + public int CrewCreditId { get; set; } + public int PersonId { get; set; } + public int MovieId { get; set; } + public string Description { get; set; } + + // relational syntactic sugar + public Movie Movie { get; set; } + public Person Person { get; set; } + } +} diff --git a/CCMovieDatabase/Models/Movie.cs b/CCMovieDatabase/Models/Movie.cs new file mode 100644 index 0000000..de19391 --- /dev/null +++ b/CCMovieDatabase/Models/Movie.cs @@ -0,0 +1,20 @@ +namespace CCMovieDatabase.Models +{ + public class Movie + { + // this class is a model for a movie object in the database + public int Id { get; set; } + public string Title { get; set; } + public string? Description { get; set; } + // TODO: how do i relate data? genres + public DateOnly ReleaseDate { get; set; } + public int RatingId { get; set; } + public string? ThumbnailURL { get; set; } + + // navigation property + public Rating Rating { get; set; } + + // collection + public virtual ICollection Characters { get; set; } + } +} diff --git a/CCMovieDatabase/Models/Person.cs b/CCMovieDatabase/Models/Person.cs new file mode 100644 index 0000000..c629723 --- /dev/null +++ b/CCMovieDatabase/Models/Person.cs @@ -0,0 +1,12 @@ +namespace CCMovieDatabase.Models +{ + public class Person + { + public int PersonId { get; set; } + public string FirstName { get; set; } + public string? LastName { get; set; } + + public virtual ICollection CrewCredits { get; set; } + public virtual ICollection ActingCredits { get; set; } + } +} diff --git a/CCMovieDatabase/Models/Rating.cs b/CCMovieDatabase/Models/Rating.cs new file mode 100644 index 0000000..db564c4 --- /dev/null +++ b/CCMovieDatabase/Models/Rating.cs @@ -0,0 +1,8 @@ +namespace CCMovieDatabase.Models +{ + public class Rating + { + public int RatingId { get; set; } + public string Name { get; set; } + } +} diff --git a/CCMovieDatabase/Program.cs b/CCMovieDatabase/Program.cs index 6941d46..40903e1 100644 --- a/CCMovieDatabase/Program.cs +++ b/CCMovieDatabase/Program.cs @@ -1,3 +1,6 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using CCMovieDatabase.Data; namespace CCMovieDatabase { public class Program @@ -5,6 +8,8 @@ public class Program public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); + builder.Services.AddDbContext(options => + options.UseSqlServer(builder.Configuration.GetConnectionString("MovieContext") ?? throw new InvalidOperationException("Connection string 'MovieContext' not found."))); // Add services to the container. builder.Services.AddControllersWithViews(); diff --git a/CCMovieDatabase/Properties/serviceDependencies.json b/CCMovieDatabase/Properties/serviceDependencies.json new file mode 100644 index 0000000..02651c7 --- /dev/null +++ b/CCMovieDatabase/Properties/serviceDependencies.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "mssql1": { + "type": "mssql", + "connectionId": "ConnectionStrings:MovieContext" + } + } +} \ No newline at end of file diff --git a/CCMovieDatabase/Properties/serviceDependencies.local.json b/CCMovieDatabase/Properties/serviceDependencies.local.json new file mode 100644 index 0000000..e3bc465 --- /dev/null +++ b/CCMovieDatabase/Properties/serviceDependencies.local.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "mssql1": { + "type": "mssql.local", + "connectionId": "ConnectionStrings:MovieContext" + } + } +} \ No newline at end of file diff --git a/CCMovieDatabase/Properties/serviceDependencies.local.json.user b/CCMovieDatabase/Properties/serviceDependencies.local.json.user new file mode 100644 index 0000000..fdc9aaa --- /dev/null +++ b/CCMovieDatabase/Properties/serviceDependencies.local.json.user @@ -0,0 +1,9 @@ +{ + "dependencies": { + "mssql1": { + "restored": true, + "restoreTime": "2025-10-20T18:24:51.6491757Z" + } + }, + "parameters": {} +} \ No newline at end of file diff --git a/CCMovieDatabase/Views/Blog/Create.cshtml b/CCMovieDatabase/Views/Blog/Create.cshtml new file mode 100644 index 0000000..534339f --- /dev/null +++ b/CCMovieDatabase/Views/Blog/Create.cshtml @@ -0,0 +1,73 @@ +@model CCMovieDatabase.Models.Article + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Article

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Blog/Delete.cshtml b/CCMovieDatabase/Views/Blog/Delete.cshtml new file mode 100644 index 0000000..06b1a8a --- /dev/null +++ b/CCMovieDatabase/Views/Blog/Delete.cshtml @@ -0,0 +1,75 @@ +@model CCMovieDatabase.Models.Article + +@{ + ViewData["Title"] = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

Article

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Body) +
+
+ @Html.DisplayFor(model => model.Body) +
+
+ @Html.DisplayNameFor(model => model.Slug) +
+
+ @Html.DisplayFor(model => model.Slug) +
+
+ @Html.DisplayNameFor(model => model.CreatedAt) +
+
+ @Html.DisplayFor(model => model.CreatedAt) +
+
+ @Html.DisplayNameFor(model => model.ModifiedAt) +
+
+ @Html.DisplayFor(model => model.ModifiedAt) +
+
+ @Html.DisplayNameFor(model => model.Author) +
+
+ @Html.DisplayFor(model => model.Author) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailUrl) +
+
+ @Html.DisplayFor(model => model.ThumbnailUrl) +
+
+ @Html.DisplayNameFor(model => model.ShortDescription) +
+
+ @Html.DisplayFor(model => model.ShortDescription) +
+
+ @Html.DisplayNameFor(model => model.IsFeatured) +
+
+ @Html.DisplayFor(model => model.IsFeatured) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/Blog/Details.cshtml b/CCMovieDatabase/Views/Blog/Details.cshtml new file mode 100644 index 0000000..b721d0e --- /dev/null +++ b/CCMovieDatabase/Views/Blog/Details.cshtml @@ -0,0 +1,72 @@ +@model CCMovieDatabase.Models.Article + +@{ + ViewData["Title"] = "Details"; +} + +

Details

+ +
+

Article

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Body) +
+
+ @Html.DisplayFor(model => model.Body) +
+
+ @Html.DisplayNameFor(model => model.Slug) +
+
+ @Html.DisplayFor(model => model.Slug) +
+
+ @Html.DisplayNameFor(model => model.CreatedAt) +
+
+ @Html.DisplayFor(model => model.CreatedAt) +
+
+ @Html.DisplayNameFor(model => model.ModifiedAt) +
+
+ @Html.DisplayFor(model => model.ModifiedAt) +
+
+ @Html.DisplayNameFor(model => model.Author) +
+
+ @Html.DisplayFor(model => model.Author) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailUrl) +
+
+ @Html.DisplayFor(model => model.ThumbnailUrl) +
+
+ @Html.DisplayNameFor(model => model.ShortDescription) +
+
+ @Html.DisplayFor(model => model.ShortDescription) +
+
+ @Html.DisplayNameFor(model => model.IsFeatured) +
+
+ @Html.DisplayFor(model => model.IsFeatured) +
+
+
+ diff --git a/CCMovieDatabase/Views/Blog/Edit.cshtml b/CCMovieDatabase/Views/Blog/Edit.cshtml new file mode 100644 index 0000000..7b3da29 --- /dev/null +++ b/CCMovieDatabase/Views/Blog/Edit.cshtml @@ -0,0 +1,74 @@ +@model CCMovieDatabase.Models.Article + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Article

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Blog/Index.cshtml b/CCMovieDatabase/Views/Blog/Index.cshtml new file mode 100644 index 0000000..bed607d --- /dev/null +++ b/CCMovieDatabase/Views/Blog/Index.cshtml @@ -0,0 +1,83 @@ +@model IEnumerable + +@{ + ViewData["Title"] = "Index"; +} + +

Index

+ +

+ Create New +

+ + + + + + + + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Title) + + @Html.DisplayNameFor(model => model.Body) + + @Html.DisplayNameFor(model => model.Slug) + + @Html.DisplayNameFor(model => model.CreatedAt) + + @Html.DisplayNameFor(model => model.ModifiedAt) + + @Html.DisplayNameFor(model => model.Author) + + @Html.DisplayNameFor(model => model.ThumbnailUrl) + + @Html.DisplayNameFor(model => model.ShortDescription) + + @Html.DisplayNameFor(model => model.IsFeatured) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Body) + + @Html.DisplayFor(modelItem => item.Slug) + + @Html.DisplayFor(modelItem => item.CreatedAt) + + @Html.DisplayFor(modelItem => item.ModifiedAt) + + @Html.DisplayFor(modelItem => item.Author) + + @Html.DisplayFor(modelItem => item.ThumbnailUrl) + + @Html.DisplayFor(modelItem => item.ShortDescription) + + @Html.DisplayFor(modelItem => item.IsFeatured) + + Edit | + Details | + Delete +
diff --git a/CCMovieDatabase/Views/Home/Index.cshtml b/CCMovieDatabase/Views/Home/Index.cshtml index bcfd79a..22800a4 100644 --- a/CCMovieDatabase/Views/Home/Index.cshtml +++ b/CCMovieDatabase/Views/Home/Index.cshtml @@ -1,8 +1,57 @@ -@{ - ViewData["Title"] = "Home Page"; +@model IEnumerable + +@{ + ViewData["title"] = "Home"; } -
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

+
+ +
+ + +
+ +
+ + +
+ @foreach (var item in Model) + { +
+
+ @item.ThumbnailUrl +
+
@item.Title
+

@item.ShortDescription

+ Read More +
+
+
+ }
diff --git a/CCMovieDatabase/Views/Jesse/Create.cshtml b/CCMovieDatabase/Views/Jesse/Create.cshtml new file mode 100644 index 0000000..c81c6b9 --- /dev/null +++ b/CCMovieDatabase/Views/Jesse/Create.cshtml @@ -0,0 +1,47 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Movie

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Jesse/Delete.cshtml b/CCMovieDatabase/Views/Jesse/Delete.cshtml new file mode 100644 index 0000000..bca40d8 --- /dev/null +++ b/CCMovieDatabase/Views/Jesse/Delete.cshtml @@ -0,0 +1,45 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/Jesse/Details.cshtml b/CCMovieDatabase/Views/Jesse/Details.cshtml new file mode 100644 index 0000000..1e74d7f --- /dev/null +++ b/CCMovieDatabase/Views/Jesse/Details.cshtml @@ -0,0 +1,42 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Details"; +} + +

Details

+ +
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+
+ diff --git a/CCMovieDatabase/Views/Jesse/Edit.cshtml b/CCMovieDatabase/Views/Jesse/Edit.cshtml new file mode 100644 index 0000000..6c3d428 --- /dev/null +++ b/CCMovieDatabase/Views/Jesse/Edit.cshtml @@ -0,0 +1,49 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Movie

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Jesse/Index.cshtml b/CCMovieDatabase/Views/Jesse/Index.cshtml new file mode 100644 index 0000000..44a9d05 --- /dev/null +++ b/CCMovieDatabase/Views/Jesse/Index.cshtml @@ -0,0 +1,53 @@ +@model IEnumerable + +@{ + ViewData["Title"] = "Index"; +} + +

Index

+ +

+ Create New +

+ + + + + + + + + + + +@foreach (var item in Model) { + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Title) + + @Html.DisplayNameFor(model => model.Description) + + @Html.DisplayNameFor(model => model.ReleaseDate) + + @Html.DisplayNameFor(model => model.Rating) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Description) + + @Html.DisplayFor(modelItem => item.ReleaseDate) + + @Html.DisplayFor(modelItem => item.Rating.RatingId) + + Edit | + Details | + Delete +
diff --git a/CCMovieDatabase/Views/Movies/Create.cshtml b/CCMovieDatabase/Views/Movies/Create.cshtml new file mode 100644 index 0000000..7fda2c8 --- /dev/null +++ b/CCMovieDatabase/Views/Movies/Create.cshtml @@ -0,0 +1,52 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Movie

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Movies/Delete.cshtml b/CCMovieDatabase/Views/Movies/Delete.cshtml new file mode 100644 index 0000000..c8ce47f --- /dev/null +++ b/CCMovieDatabase/Views/Movies/Delete.cshtml @@ -0,0 +1,51 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/Movies/Details.cshtml b/CCMovieDatabase/Views/Movies/Details.cshtml new file mode 100644 index 0000000..ba7197f --- /dev/null +++ b/CCMovieDatabase/Views/Movies/Details.cshtml @@ -0,0 +1,48 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Details"; +} + +

Details

+ +
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+
+ diff --git a/CCMovieDatabase/Views/Movies/Edit.cshtml b/CCMovieDatabase/Views/Movies/Edit.cshtml new file mode 100644 index 0000000..3ac2c75 --- /dev/null +++ b/CCMovieDatabase/Views/Movies/Edit.cshtml @@ -0,0 +1,54 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Movie

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Movies/Index.cshtml b/CCMovieDatabase/Views/Movies/Index.cshtml new file mode 100644 index 0000000..edffcfa --- /dev/null +++ b/CCMovieDatabase/Views/Movies/Index.cshtml @@ -0,0 +1,59 @@ +@model IEnumerable + +@{ + ViewData["Title"] = "Index"; +} + +

Index

+ +

+ Create New +

+ + + + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Title) + + @Html.DisplayNameFor(model => model.Description) + + @Html.DisplayNameFor(model => model.ReleaseDate) + + @Html.DisplayNameFor(model => model.ThumbnailURL) + + @Html.DisplayNameFor(model => model.Rating) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Description) + + @Html.DisplayFor(modelItem => item.ReleaseDate) + + @Html.DisplayFor(modelItem => item.ThumbnailURL) + + @Html.DisplayFor(modelItem => item.Rating.RatingId) + + Edit | + Details | + Delete +
diff --git a/CCMovieDatabase/Views/PorterList/Create.cshtml b/CCMovieDatabase/Views/PorterList/Create.cshtml new file mode 100644 index 0000000..7fda2c8 --- /dev/null +++ b/CCMovieDatabase/Views/PorterList/Create.cshtml @@ -0,0 +1,52 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Movie

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/PorterList/Delete.cshtml b/CCMovieDatabase/Views/PorterList/Delete.cshtml new file mode 100644 index 0000000..c8ce47f --- /dev/null +++ b/CCMovieDatabase/Views/PorterList/Delete.cshtml @@ -0,0 +1,51 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/PorterList/Details.cshtml b/CCMovieDatabase/Views/PorterList/Details.cshtml new file mode 100644 index 0000000..41044de --- /dev/null +++ b/CCMovieDatabase/Views/PorterList/Details.cshtml @@ -0,0 +1,55 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Details"; +} + +

Details

+ +
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailURL) +
+
+ @if (Model.ThumbnailURL != null) + { + + } + else + { +

No Thumbnail

+ } +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+
+ diff --git a/CCMovieDatabase/Views/PorterList/Edit.cshtml b/CCMovieDatabase/Views/PorterList/Edit.cshtml new file mode 100644 index 0000000..3ac2c75 --- /dev/null +++ b/CCMovieDatabase/Views/PorterList/Edit.cshtml @@ -0,0 +1,54 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Movie

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/PorterList/Index.cshtml b/CCMovieDatabase/Views/PorterList/Index.cshtml new file mode 100644 index 0000000..4853a4a --- /dev/null +++ b/CCMovieDatabase/Views/PorterList/Index.cshtml @@ -0,0 +1,107 @@ +@model IEnumerable + +@{ + ViewData["Title"] = "Index"; +} + +@*

Index

+ +

+ Create New +

+ + + + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Title) + + @Html.DisplayNameFor(model => model.Description) + + @Html.DisplayNameFor(model => model.ReleaseDate) + + @Html.DisplayNameFor(model => model.ThumbnailURL) + + @Html.DisplayNameFor(model => model.Rating) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Description) + + @Html.DisplayFor(modelItem => item.ReleaseDate) + + @if (item.ThumbnailURL != null) + { + + } + else + { +

No Thumbnail

+ } +
+ @Html.DisplayFor(modelItem => item.Rating.RatingId) + + Edit | + Details | + Delete +
+ +*@ +
+ @foreach (var item in Model) + { + +
+ @item.ThumbnailURL +
+
@item.Title
+

@item.Description

+ Details +
+
+ } +
+ + + +@*
+ @foreach (var item in Model) + { +
+
+ @item.ThumbnailUrl +
+
@item.Title
+

@item.ShortDescription

+ Read More +
+
+
+ } +
+ +*@ \ No newline at end of file diff --git a/CCMovieDatabase/Views/Shared/_Layout.cshtml b/CCMovieDatabase/Views/Shared/_Layout.cshtml index 7123acd..2b434f5 100644 --- a/CCMovieDatabase/Views/Shared/_Layout.cshtml +++ b/CCMovieDatabase/Views/Shared/_Layout.cshtml @@ -26,6 +26,18 @@ + + + +
diff --git a/CCMovieDatabase/appsettings.json b/CCMovieDatabase/appsettings.json index 10f68b8..448481c 100644 --- a/CCMovieDatabase/appsettings.json +++ b/CCMovieDatabase/appsettings.json @@ -5,5 +5,8 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" -} + "AllowedHosts": "*", + "ConnectionStrings": { + "MovieContext": "Server=(localdb)\\mssqllocaldb;Database=CCMovieDatabase;Trusted_Connection=True;MultipleActiveResultSets=true" + } +} \ No newline at end of file