This is a Game Store REST API project developed using ASP.NET Core. The project demonstrates how to build a complete Web API using the latest ASP.NET Core features.
- Data access using Entity Framework Core
- Complete CRUD operations implementation
- Data Transfer Objects (DTOs) for data transmission
- Route grouping implementation
- Data validation
- Dependency injection
- Asynchronous programming model
GamesEndpoints
: Handles CRUD operations for gamesGenresEndpoints
: Handles genre queriesGameStoreContext
: Entity Framework Core database context- Data Models: Includes Game and Genre entities
- ASP.NET Core
- Entity Framework Core
- SQLite Database
- Latest C# Features
- Ensure .NET SDK is installed
- Clone this repository
- In the project root directory, run:
dotnet run
- GET /games - Retrieve all games
- GET /games/{id} - Retrieve a specific game
- POST /games - Add a new game
- PUT /games/{id} - Update a game
- DELETE /games/{id} - Delete a game
- GET /genres - Retrieve all game genres
Database migrations are automatically executed on application startup (app.MigrateDbAsync()
).
The database connection string is configured in the application settings:
var connString = builder.Configuration.GetConnectionString("GameStore");
The project follows a clean architecture approach:
- Endpoints are organized using route groups
- Data models are separated from DTOs
- Mapping logic is isolated in extension methods
- Database context is configured with dependency injection
The API implements comprehensive error handling:
- Validates input data
- Returns appropriate HTTP status codes
- Provides meaningful error messages
The API is designed to be easily integrated with various frontend frameworks, providing:
- Consistent JSON responses
- CORS support if needed
- Well-documented endpoints