Welcome to the E-Commerce Project! This is a comprehensive solution designed to manage an e-commerce store, featuring a fully functional admin dashboard, product management, and customer interactions.
This README will guide you through the setup and installation of the project on your local machine, covering dependencies, database configuration, and migration instructions.
- Manage Products: Admin users can view, add, update, and delete products from the store.
- Statistics: View overall statistics such as the total number of users, products, and sales data.
- Product Categories: Ability to organize products into categories.
- Manage Orders:Ability to consult Customer or order and update their status
- Login:Login with a predifined account
- Product Browsing: Customers can browse available products displayed as cards.
- Add to Cart: Customers can add products to their shopping cart.
- View Cart: A simple, user-friendly cart to review items before proceeding to checkout.
- Filters:Filters for the category,name of the product,min price,max price.
- Consult Orders:Consult the hisory of order and their Status (Shipped,pending,delivred)
- Login/Register: Users can register new accounts and log in to the store.
- Role-based Access: Differentiates between customer and admin users, providing access to different parts of the site.
- Order Creation: Customers can place orders for products in their cart.
- Order History: View a history of past orders.
- Order Confirmation: Users receive email confirmations for successful orders.
- Order Status: Users recieve mail for the status updates
- Payment: users can pay using stripe
Before setting up the project, ensure you have the following installed on your local machine:
- .NET SDK (Recommended version: 9.0)
- SQL Server or any compatible database (PostgreSQL, MySQL, etc.)
- Visual Studio (optional, but recommended for development)
- Entity Framework Core Tools (for running database migrations)
To start using the project, first, clone the repository to your local machine:
git clone https://github.com/Chouikhi-abdallah/asp.net-mvc-v9-Ecommerce-website
cd projrun the following command
dotnet restoreThe application requires a database connection to store and manage data. You need to update the connection string in the appsettings.json file.
Open the appsettings.json file in the root of the project. Find the ConnectionStrings section, which looks like this: json
"ConnectionStrings": {
"DefaultConnection": "YourConnectionStringHere"
}Replace "YourConnectionStringHere" with your actual database connection string. If you're using SQL Server, it might look something like this: json
"DefaultConnection": "Server=localhost;Database=ECommerceDb;Trusted_Connection=True;"If you're using a different database (e.g., PostgreSQL or MySQL), make sure to adjust the connection string accordingly.
If you wish to enable email notifications, you need to configure the SMTP settings for sending emails. Update the EmailSettings section in appsettings.json:
"EmailSettings": {
"SmtpServer": "smtp.your-email-provider.com",
"SmtpPort": 587,
"SmtpUser": "[email protected]",
"SmtpPassword": "your-email-password"
}Replace the placeholders with your actual SMTP server information. This will allow the application to send email notifications for order confirmations and other alerts.
Once your connection string is set up, it's time to apply the database migrations to set up your database schema.
Run the following command in the terminal:
dotnet ef database update
This will create the necessary tables in your database. If you encounter any issues, ensure your database is running and accessible, and that the connection string is correct.You can seed the database with some initial data, such as default products or users, by running the following command:
dotnet ef database update --seedThis step is optional but useful for testing the application with some predefined data.
With everything set up, you can now run the application locally:
dotnet runThe application will start, and you can access it at http://localhost:5000 (or another port if specified). You should see the e-commerce storefront where customers can browse products, log in, and place orders.
Here’s a breakdown of the main project folders and files:
Controllers: Contains the application logic for handling HTTP requests. Includes controllers for managing products, orders, and users. Models: Defines the data structure for entities like products, orders, and users. Views: Contains the Razor Views for rendering HTML pages. Organized by user type (admin and customer). Data: Contains the application’s database context and migration files. wwwroot: Stores static files like images, CSS, and JavaScript. appsettings.json: Configuration file for connection strings, email settings, and other application settings.
We welcome contributions to improve this project! If you’d like to help out, feel free to fork the repository and submit a pull request. Before contributing, please make sure to:
Create an issue for any proposed changes. Follow the existing code style and structure. Ensure tests are updated or added for new features.
This project is licensed under the MIT License - see the LICENSE file for details.
If you run into any issues while setting up the project, here are some common solutions:
Issue: Database connection errors Ensure your database is running and the connection string is correct. If you're using SQL Server, verify that the server is accessible (e.g., localhost or a remote server). Issue: Missing migrations If you encounter an error regarding missing migrations, try running:
dotnet ef migrations add InitialCreate
dotnet ef database updateThis will generate the initial migrations and apply them to the database.
Entity Framework Core for ORM functionality. ASP.NET Core for building the web application. Bootstrap for responsive design. SendGrid for email notifications (if using SendGrid for email service).