How trhiep/license-key-shop works
Project Type and Purpose
• The project is a web application built using ASP.NET (MVC/Razor Pages) as seen by folders like Controllers, Models, Views, and Pages.
• Its purpose—as per the assignment context (PRN211 Assignment Fall23) and use of a website template—is to serve as an online license key shop with functionalities such as product management, user registration/login, order history, and payment/deposit processing.
Main Architectural Components
A. Client/Browser:
• End-users accessing the shop through a web browser.
B. Web Server (Application Layer):
• Controllers: Handle incoming HTTP requests (e.g., AdminController, CartController, ProductManagementController, etc.).
• Models: Define data structures and business objects (e.g., User, Product, OrderHistory) including ORM context (LicenseShopDBContext) hinting at Entity Framework usage.
• Views & Pages: Render the UI using Razor templates (found under Views, Pages, and Shared folders). Separate layouts for admin and customer areas are available.
C. Data Access Layer:
• The ADO folder (with files like OrderHistoryADO.cs) and LicenseShopDBContext in Models provide the database integration layer.
• Underlying database (e.g., SQL Server) that stores user, product, order, and payment data.
D. Utilities and External Integration:
• The Utils folder contains helper classes (CloudinaryUploader, EmailSender, EncryptionMethods, Payment models, and VnPayService) that integrate with external services (cloud storage, email, payment gateway).
• MyInterface defines contracts like IEmailSender and IVnPayService, outlining the abstraction for external services.
E. Static Assets:
• The wwwroot folder holds CSS, JavaScript, images, and third-party libraries (Bootstrap, jQuery, TinyMCE, etc.) needed for the front-end presentation.
Relationships and Interactions
• The client initiates requests via the browser, which hit the web server.
• The Controllers process these requests, potentially using the Models for business logic and data.
• When persistent data is needed, controllers interact with the Data Access Layer (using LicenseShopDBContext/ADO classes) to communicate with the database.
• The Utilities layer provides additional services such as emailing, file uploads (Cloudinary), and payment processing (VnPay), which may be invoked by controllers or business logic.
• Views and Pages are used to render the results back to the client.
Architectural Patterns and Principles
• MVC (Model-View-Controller) is the primary pattern used. This enforces separation of concerns between the UI (Views/Pages), the business logic (Controllers/Models), and data access.
• There is also a layering principle, with clear boundaries between presentation, business logic, data access, and utility/integration layers.
• Abstraction via interfaces (e.g., IEmailSender, IVnPayService) allows for flexibility and easier testing.