How quangphatt/godzillarestaurantaspnetmvc works
Main Components
• Frontend (Presentation Layer): Represented by the Views (under GodzillaRestaurant/Views and wwwroot for static assets like CSS, JS, and images). These views are served to the client browsers.
• Controllers (MVC Layer): The controllers such as AccountController, AdminController, BookingController, etc., handle incoming HTTP requests and orchestrate interactions between the view and the business logic.
• Business Logic / Services Layer: Located in the Services folder, these interfaces (e.g., IBookingService, IFoodService) and their implementations handle core processing (like booking, ordering, mailing) and coordinate with the data access layer.
• Data Access Layer (DAL): The DAL folder under GodzillaRestaurant/DataAccessLayer contains repositories like BookingDAL, FoodDAL, and others. They encapsulate database operations.
• Models / Domain Layer: The Models directory provides the data structures (e.g., Booking, Order, Food) that represent the entities in your application.
• Database: The PostgreSQL database is referenced by the connection string in appsettings.json and configured via Entity Framework’s migrations in the Migrations folder.
• External Services: The email functionality (using credentials stored in the .env file) for account registration and password changes is a notable external integration. In addition, hosting on Microsoft Azure also forms a part of the deployment & infrastructure component.
Relationships and Interactions
• User requests are received by Controllers which process the request and interact with the Services.
• Services call the Data Access Layer to perform CRUD operations on the PostgreSQL database.
• Data flows from the Database back through DAL and Services to the Controllers, which then pass appropriate data to the Views.
• Static files (CSS, JS, images) and client-side libraries (e.g., Bootstrap, jQuery) are served from the wwwroot folder.
• Administrative functionality (e.g., menu management, bookings, and orders) is handled via specialized controllers (like AdminController) with their dedicated Views.
• The Entity Framework migrations manage the evolution of the database schema over time.
Architectural Patterns and Design Principles
• MVC (Model-View-Controller): Clearly separates concerns between front-end UI, business logic, and data handling.
• Repository Pattern: Evident in the DataAccessLayer where data operations are abstracted.
• Dependency Injection: Indicated by the use of service interfaces (IBookingService, IFoodService, etc.) to promote loose coupling.
• Separation of Concerns: Different directories for Controllers, Views, Models, Services, and DAL reinforce this principle.
Relevant Technologies and Frameworks
• ASP.NET MVC running on .NET 7.0.
• Entity Framework (with migrations) for ORM and database interactions.
• PostgreSQL as the database backend.
• Frontend frameworks/libraries like Bootstrap, jQuery, and client-side validation libraries.
Additional Details to Consider
• For the “Migration” component: Include a small module labeled “Migrations” that feeds into the Database component to show how schema changes are applied.
• Dependency on static content in the wwwroot folder, which feeds into the User Interface.
• How the Controllers are organized by different functionalities (Account, Admin, Booking, Order, etc.), perhaps by grouping or annotations if needed.