How tnjkl/websitebanmohinh works
Main Components
• Frontend / Public Site: Represented by the “Controllers” (e.g., HomeController, ProductController, CartController, etc.), “Views” (located in Views folders for Account, Home, Product, etc.) and the static content in “wwwroot” (including CSS, JavaScript, images, and media). This forms the user-facing part of the application.
• Admin Area: Located under “Areas/Admin” with its own Controllers, Views, and Repository, dedicated to managing products, orders, roles, users, etc.
• Business Logic & Services Layer: Consisting of Helpers, Services (e.g., Momo and Vnpay payment services), and Repository components that encapsulate data access and business logic.
• Data Access Layer: The “Repository” folder and DataContext, along with the “Migrations” folder, indicate the use of Entity Framework for interacting with a SQL database.
• Models: All the domain models (ProductModel, CategoryModel, OrderModel, etc.) representing the data structures used throughout the application.
• External Integrations: Payment integration libraries are present (VnPayLibrary, Momo service components), and Identity management is used (e.g., roles, users seeded in SeedData) which might use a third-party OAuth (per the README’s instructions to set up Google OAuth keys).
• Real-Time Communication: The “Hubs” folder with the ChatHub indicates support for real-time chat features (using SignalR).
Relationships and Interactions
• The Client Layer (User's Browser) sends HTTP requests to the Web Server.
• The Controllers (both in the Public area and Admin area) handle incoming requests, interact with the Services and Repositories to process business logic, and then render Views (via the MVC pattern).
• The Data Access layer (using DataContext and Entity Framework) interfaces with the SQL Database. This includes typical CRUD operations and data seeding (SeedData).
• External payment services (Momo and VnPay) are connected via dedicated Service layers and Libraries, which the PaymentController and payment services in views use to process transactions.
• SignalR’s ChatHub enables real-time messaging, which is used by the Messages components.
Architectural Patterns and Design Principles
• MVC (Model-View-Controller): The structure clearly separates Presentation (Views), Business Logic (Controllers and Services), and Data Access (Models and Repositories).
• Separation of Concerns: The Admin area is separated into its own folder and uses its version of Controllers, Views, and Repositories.
• Integration of External Services: Payment processing and OAuth authentication are integrated modules.
Relevant Technologies and Frameworks
• ASP.NET MVC and Entity Framework for the web application and data persistence.
• SignalR for real-time chat support.
• Identity Framework for user and role management.
• Frontend libraries such as Bootstrap, jQuery, and additional libraries for validation and other UI enhancements.