This repository contains a .NET 8.0 Web API project (MagicVilla API) together with an ASP.NET Core MVC Client (MagicVilla Web) that consumes the API.
The solution demonstrates modern software engineering practices such as N-Tier Architecture, Repository & Unit of Work patterns, Authentication & Authorization with Identity & JWT, Logging, Caching, Pagination, and more.
- Structured into layers (API, Utility, MVC Client).
- Enforced separation of concerns and testability.
- SQL Server.
- Repository & Unit of Work patterns for data access.
- ASP.NET Core Identity for user management.
- JWT (JSON Web Token) for authentication.
- Role-based authorization for securing API endpoints and MVC client features.
- Serilog for structured logging and better monitoring.
- Simplified mapping between DTOs, entities, and view models.
- Used
async
andawait
for scalability and responsiveness.
- Versioned APIs for backward compatibility.
- Implemented caching for performance optimization.
- Pagination support for retrieving villas efficiently.
- API documentation and testing with Swagger UI.
- Separate MVC Project consuming the API.
- Implemented Bootstrap for styling.
- SweetAlert for better user interaction.
- .NET 8.0 Web API
- ASP.NET Core MVC 8.0 (for consuming API)
- Entity Framework Core
- Repository & Unit of Work Patterns
- Serilog Logging
- AutoMapper
- ASP.NET Core Identity
- JWT Authentication
- Swagger
- API Versioning
- Caching
- Pagination
- SweetAlert
- Bootstrap
- SQL Server
-
MagicVilla_Utility
Shared project for constants and helper classes (e.g.,SD.cs
). -
MagicVilla_VillaAPI (Web API project)
- Controllers/ → API controllers for managing villas and authentication.
- Data/ → Database context and seed data.
- Migrations/ → EF Core migrations for database schema changes.
- Models/ → Entities and Data Transfer Objects (DTOs).
- Repository/ → Repository and Unit of Work implementations.
- MappingConfig.cs → AutoMapper configuration.
- Program.cs, appsettings.json, etc.
-
MagicVilla_Web (MVC client project consuming the API)
- Controllers/ → MVC controllers.
- Models/ → ViewModels and DTOs used in the MVC layer.
- Services/ → Consuming the API (HttpClient, authentication, etc.).
- Views/ → Razor views for UI.
- wwwroot/ → Static assets (Bootstrap, CSS, JavaScript, images).
git clone https://github.com/MuhammedReda263/MagicVilla_WebAPI.git cd MagicVilla_WebAPI
MagicVilla_VillaAPI/appsettings.json
dotnet ef database update --project MagicVilla_VillaAPI
dotnet run --project MagicVilla_VillaAPI
dotnet run --project MagicVilla_Web
ء