# vanminhnguyenbmt/asp.net-mvc architecture

> Architecture diagram of the GitHub repository vanminhnguyenbmt/asp.net-mvc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vanminhnguyenbmt/asp.net-mvc
- Repository: https://github.com/vanminhnguyenbmt/asp.net-mvc

## Overview

##### Main Components
- Web Presentation Layer: Represented by the ASP.NET MVC “BanDongHo” project that contains Views, Controllers, Scripts, CSS, and images. Note that there is also an “Areas/Admin” folder for administration functions.
- Domain/Data Layer: The “BanDongHo.Domain” project contains entity classes (e.g., Cart, CartItem, and various entity classes like DONHANG, SANPHAM), data context files (using Entity Framework with EDMX files), and configuration files. This clearly models your business objects and data relationships.
- Database: There is a “Database” folder containing SQL scripts (BanDongHo.sql) and sample data inserts (Insert-DB.sql), which represent your underlying relational database.
- Common/Utility Components: The “Common” folder includes helper classes for configuration, encryption, and email functionalities. These support the overall business logic.
- Third-Party Dependencies: Numerous NuGet packages (e.g., EntityFramework, Captcha, Microsoft.ApplicationInsights, jQuery libraries, Bootstrap, etc.) indicate integration with standard frameworks and monitoring tools.

##### Relationships and Interactions
- The user (client browser) interacts with the web presentation layer (Views and Controllers). The Controllers (in both root and Admin areas) invoke services residing in the “Models/Service” and “Areas/Admin/Models” directories.
- The services leverage the domain classes and the EF data context (in “BanDongHo.Domain/DataContext”) to read/write data from the database.
- The Common utilities support various components (e.g., logging, emailing, and configuration).
- The Admin area (separate MVC area) provides functionalities for managing products, orders, promotions, and user management. This area has its own Controllers, Views, and Models.

##### Architectural Patterns and Design Principles
- MVC Pattern: Show the separation of concerns between Views (UI), Controllers (request handling), and Models (business logic and data).
- Domain Driven Design: There is a dedicated Domain project that encapsulates business rules and data mapping (with EDMX and EF code generation).
- Layered Architecture: The architecture is divided between presentation, business logic/services, data access, and database layers.
- Use of Areas: The “Admin” area reflects a modular separation within MVC for administrative functions.

##### Relevant Technologies and Frameworks
- ASP.NET MVC framework for building the website.
- Entity Framework (with EDMX and T4 templates) for ORM.
- NuGet package integrations (e.g., Captcha for security, Application Insights for monitoring, Bootstrap/jQuery for front-end).
- Microsoft’s tooling (Visual Studio configurations, web.config settings) which support the runtime and compilation processes.

- Specifics like the “Areas/Admin” module, pointing out its separate controllers, views, and models.
- Domain project as the central repository for business objects such as Cart, Product, Order, Customer, etc.
- Optionally, denote external dependencies (e.g., Application Insights, third-party libraries) somewhere near the borders of the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Web Client (Browser)"]:::client

    subgraph "Presentation Layer"
        B["ASP.NET MVC Frontend (BanDongHo)"]:::presentation
        E["Admin Module (BanDongHo/Areas/Admin)"]:::presentation
    end

    C["Business Services"]:::service
    D["Domain/Data Layer (BanDongHo.Domain)"]:::domain
    F["Database (Database)"]:::database
    G["Common/Utility Components (BanDongHo/Common)"]:::common
    H["Third-Party Dependencies"]:::thirdparty

    A -->|"requests"| B
    A -->|"requests"| E
    B -->|"callsService"| C
    E -->|"callsService"| C
    C -->|"accesses"| D
    D -->|"communicatesWith"| F
    G -->|"supports"| B
    G -->|"supports"| C
    H -->|"integratesWith"| B
    H -->|"integratesWith"| D

    click B "https://github.com/vanminhnguyenbmt/asp.net-mvc/tree/master/BanDongHo"
    click D "https://github.com/vanminhnguyenbmt/asp.net-mvc/blob/master/BanDongHo.Domain"
    click F "https://github.com/vanminhnguyenbmt/asp.net-mvc/tree/master/Database"
    click G "https://github.com/vanminhnguyenbmt/asp.net-mvc/tree/master/BanDongHo/Common"
    click E "https://github.com/vanminhnguyenbmt/asp.net-mvc/tree/master/BanDongHo/Areas/Admin"

    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef presentation fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef service fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef domain fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef database fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef common fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef thirdparty fill:#E6E6FA,stroke:#000,stroke-width:2px;
```
