A project that contributed towards my computer science A-Level, ASP.NET MVC with Razor views, all paired with a SQL Server database storing data regarding products & user accounts.
This application's core functionality is an online shopping system, upon authentication, users can access a range of featured products handled through the stock management system. Administrative roles are enabled through role-based access control, they can manage stock levels and add/edit/remove products.
Users can build a basket of products and 'order' them, the order will be accessible through the corresponding account's order history.
- User Registration and Login: Customers can register and log into their accounts.
- Product Search: Search for products by type or description using an autocomplete search box.
- Shopping Cart: Add products to the cart, edit quantities, and delete items.
- Order Placement: Place orders and view a confirmation page after finalizing the order.
- Order History: Returning customers can view their current and previous orders.
- Stock Management: Administrators can view low-stock items, add new products, edit existing products, and delete products.
- Order Stock: Replenish stock for low-stock items with a single click.
- Role-Based Access: Admins have access to stock management features, while customers only see shopping-related features.
- Backend: ASP.NET Core MVC (C#)
- Frontend: Razor Views, HTML, CSS, JavaScript, jQuery, Bootstrap
- Database: Microsoft SQL Server
- Authentication: Cookie-based authentication with role-based access control
- Dependency Injection: Used for repository and service management
- Libraries:
- Dapper for lightweight ORM
- jQuery Validation for client-side form validation
- Bootstrap for responsive UI design
- Visual Studio: IDE for development
- VS Code: For GitHub deployment and README generation
The project is organized as follows:
shoppingmvc
├── Controllers/ # MVC Controllers for handling requests
├── Database/ # Repositories and database connection logic
├── Models/ # Data models for the application
├── Views/ # Razor views for rendering UI
├── wwwroot/ # Static files (CSS, JS, images)
├── appsettings.json # Configuration file for database connection
├── Startup.cs # Application startup configuration
├── Program.cs # Main entry point of the application
└── ShoppingToYou.csproj # Project file
- .NET 5.0 SDK or later
- Microsoft SQL Server
- Visual Studio 2022
- Node.js (optional, for managing frontend dependencies)
- Git (for cloning repository)
-
Clone the repository:
git clone https://github.com/your-username/Online-Shopping-Web-Application.git -
Navigate to the project directory:
cd shoppingmvc -
Open the solution in Visual Studio 2022
-
Configure the database connection:
- Update the DefaultConnection string in appsettings.json to point to your SQL Server instance.
-
Restore dependencies:
dotnet restore -
Run the database migrations to create the database schema:
Update-Database -
Build the project:
dotnet build -
Run the application:
dotnet run
- Register a new user account or log in with an exisiting account
- Browse products and add them to your shopping cart
- Proceed to checkout to place an order
- Administrators can log in to access the admin panel for stock management
- Startup.cs: Configures services and middleware for the application.
- SqlServerConnection.cs: Manages the database connection.
- StockController.cs: Handles stock management features.
- OrderController.cs: Handles customer order-related features.
- AccountController.cs: Manages user authentication and registration.
- Bootstrap for responsive UI components.
- Dapper for lightweight ORM functionality.
- jQuery for client-side scripting.
Contributions are welcome!
Please fork the repository and submit a pull request with your changes.
For any questions or feedback, feel free to reach out:
- Email: [email protected]
- GitHub: Mattytomo365