Merged
Conversation
Introduce GameModel entity with Creator relationship to track game creators. Add GamesController for CRUD operations and corresponding Razor views (Create, Edit, Delete, Details, Index). Include database migrations for schema updates, adding CreatorId to GameModels and establishing foreign key constraints. Add GameListViewModel for paginated game listings. Downgrade target framework to .NET 9.0 and adjust package versions.
Introduce GameModel entity with Creator relationship to track game creators. Add GamesController for CRUD operations and corresponding Razor views (Create, Edit, Delete, Details, Index). Include database migrations for schema updates, adding CreatorId to GameModels and establishing foreign key constraints. Add GameListViewModel for paginated game listings. Downgrade target framework to .NET 9.0 and adjust package versions.
The closing curly brace (`}`) at the end of the `GameListViewModel` class in `GameModel.cs` was removed. This change ensures the class is properly closed to prevent syntax errors.
Updated the `GameModels` table to include a nullable `OwnerId` column, replacing the required `CreatorId` and `Creator` properties. Modified the `Rating` property to allow null values (`int?`) for greater flexibility. Adjusted the `ApplicationDbContextModelSnapshot` and `GameModel` class to reflect these changes.
The `GamesController.cs` file has been entirely removed, including all CRUD actions for managing `GameModel` entities, dependency injection, and helper methods like `GameModelExists`. All associated Razor views (`Index.cshtml`, `Create.cshtml`, `Edit.cshtml`, `Delete.cshtml`, `Details.cshtml`) have also been removed. These views previously handled the UI for managing `GameModel` entities. The `Index.cshtml` file was modified to update the page title from "Index" to "Games" in the `ViewData["Title"]` and `<h1>` tags. This change may indicate a partial or ongoing refactor.
Enhanced `GameModelsController` to support user authentication: - Added `UserManager<ApplicationUser>` dependency. - Applied `[Authorize]` to `Create` actions. - Ensured `Create` POST action sets `OwnerId` to the logged-in user. Simplified `Create.cshtml` by removing the `Rating` field and its UI elements.
…tion script to use new OwnerId property.
Member
SuperGamer001
left a comment
There was a problem hiding this comment.
It's possible I'm having migration issues again. :(
I'm getting an error on line 29 in the GameModelController that I have an invalid column name named "OwnerId"
SuperGamer001
approved these changes
Dec 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18
This pull request implements ownership tracking for games, enforces that only authenticated users can create games, and introduces a new
GameListViewModelfor improved listing and pagination. It also cleans up obsolete migrations and updates some NuGet package versions. The most important changes are grouped below:Game Ownership and Authorization:
OwnerIdfield to theGameModelentity, established a foreign key relationship toApplicationUser, and updated the controller logic to set the owner to the currently logged-in user when creating a game. Only authenticated users can access the create action, and overposting ofOwnerIdis prevented. [1] [2] [3] [4] [5] [6] [7] [8] [9]Game List View Model:
GameListViewModelclass to support paginated and searchable game listings, paving the way for future UI improvements. [1] [2]UI and Usability Improvements:
Create.cshtmlview to remove the hidden rating input, simplifying the form for game creation.Index.cshtmlview for games by updating the title from "Index" to "Games" for better clarity.Package Management:
Microsoft.AspNetCore.Identity.UINuGet package from version 9.0.10 to 9.0.3 to address compatibility or dependency issues.Miscellaneous: