Skip to content

A .NET 8 Web API for managing villas with an ASP.NET Core MVC client. Implements N-Tier Architecture, Repository & Unit of Work, Identity & JWT Authentication, Serilog Logging, Caching, Pagination, Swagger, and more.

Notifications You must be signed in to change notification settings

MuhammedReda263/MagicVilla_WebAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MagicVilla Web API & MVC Client

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.


What’s Implemented in This Project

1. N-Tier Architecture

  • Structured into layers (API, Utility, MVC Client).
  • Enforced separation of concerns and testability.

2. Entity Framework Core Integration

  • SQL Server.
  • Repository & Unit of Work patterns for data access.

3. Authentication & Authorization

  • ASP.NET Core Identity for user management.
  • JWT (JSON Web Token) for authentication.
  • Role-based authorization for securing API endpoints and MVC client features.

4. Logging

  • Serilog for structured logging and better monitoring.

5. AutoMapper

  • Simplified mapping between DTOs, entities, and view models.

6. Asynchronous Programming

  • Used async and await for scalability and responsiveness.

7. API Versioning

  • Versioned APIs for backward compatibility.

8. Caching & Pagination

  • Implemented caching for performance optimization.
  • Pagination support for retrieving villas efficiently.

9. Swagger Integration

  • API documentation and testing with Swagger UI.

10. MVC Client

  • Separate MVC Project consuming the API.
  • Implemented Bootstrap for styling.
  • SweetAlert for better user interaction.

Technologies Used

  • .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

Project Structure

  • 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).

How To Run

1. Clone the Repository

git clone https://github.com/MuhammedReda263/MagicVilla_WebAPI.git cd MagicVilla_WebAPI

2. Update Database Connection

MagicVilla_VillaAPI/appsettings.json

3. Apply Database Migrations

dotnet ef database update --project MagicVilla_VillaAPI

4. Run the API

dotnet run --project MagicVilla_VillaAPI

5. Run the MVC Client

dotnet run --project MagicVilla_Web

ء

About

A .NET 8 Web API for managing villas with an ASP.NET Core MVC client. Implements N-Tier Architecture, Repository & Unit of Work, Identity & JWT Authentication, Serilog Logging, Caching, Pagination, Swagger, and more.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages