A fully functional ASP.NET Core MVC e-commerce website for selling premium nuts and dried fruits with user authentication, product management, shopping cart, and admin features.
π― Key Features
Customer Features
β
User Authentication
- User registration with email validation
- Secure login with password hashing (SHA256)
- User profile management
- Session-based authentication
β
Shopping Experience
- Browse all products with professional layout
- Search products by name/description
- Filter by category
- Sort by (Name, Price, Rating, Newest)
- View detailed product information
- Add/remove items from shopping cart
- Quantity management
β
Product Reviews
- Rate products (1-5 stars)
- Write product reviews
- View average rating and all reviews
- See other customersβ feedback
β
Checkout & Orders
- Professional checkout flow
- Order summary with shipping & tax
- Tracking number generation
- Order confirmation with details
- Estimated delivery dates
Admin Features
β
Admin Dashboard
- Total revenue analytics
- Total orders count
- Products inventory
- User statistics
- Recent orders overview
β
Product Management
- Add new products
- Edit existing products
- Delete products
- Upload product images
- Manage stock quantities
- Set prices
β
Order Management
- View all orders
- Order details with items
- Update order status
- Track shipments
- Customer information
π Project Structure
NutShop/
βββ Controllers/
β βββ AccountController.cs # User registration & login
β βββ AdminController.cs # Admin dashboard & management
β βββ CartController.cs # Shopping cart operations
β βββ CheckoutController.cs # Order processing
β βββ HomeController.cs # Home page
β βββ ProductsController.cs # Product browsing & reviews
βββ Models/
β βββ User.cs # User account model
β βββ Product.cs # Product model
β βββ Category.cs # Product category
β βββ CartItem.cs # Shopping cart item
β βββ Order.cs # Customer order
β βββ OrderItem.cs # Order line item
β βββ Review.cs # Product review
βββ Services/
β βββ AuthService.cs # Password hashing service
βββ Data/
β βββ ApplicationDbContext.cs # Entity Framework DbContext
βββ Views/
β βββ Account/ # Login, Register, Profile
β βββ Admin/ # Dashboard, Products, Orders
β βββ Cart/ # Shopping cart
β βββ Checkout/ # Checkout & Confirmation
β βββ Home/ # Home page
β βββ Products/ # Products listing & details
β βββ Shared/ # Layout & shared views
βββ wwwroot/
β βββ css/ # All stylesheets
β βββ js/ # JavaScript files
β βββ images/ # Product images
βββ Program.cs # Application startup
βββ NutShop.csproj # Project file
ποΈ Database Schema
Users Table
- Id (Primary Key)
- FullName
- Email (Unique)
- PasswordHash (SHA256)
- PhoneNumber
- ShippingAddress
- RegisteredAt
- IsAdmin
Products Table
- Id
- Name
- Description
- Price
- CategoryId (Foreign Key)
- StockQuantity
- ImageUrl
- CreatedAt
Categories Table
CartItems Table
- Id
- UserId
- ProductId (Foreign Key)
- Quantity
- UnitPrice
- AddedAt
Orders Table
- Id
- UserId (Foreign Key)
- OrderDate
- Status
- TotalAmount
- ShippingAddress
- PhoneNumber
- Email
- TrackingNumber
- EstimatedDelivery
OrderItems Table
- Id
- OrderId (Foreign Key)
- ProductId (Foreign Key)
- Quantity
- UnitPrice
- TotalPrice
Reviews Table
- Id
- ProductId (Foreign Key)
- UserId (Foreign Key)
- Rating (1-5)
- Comment
- CreatedAt
π Getting Started
Prerequisites
- .NET 8.0 or later
- Visual Studio or VS Code
- Git
Installation & Running
- Clone the repository
git clone <repository-url>
cd NutShop
- Restore packages
- Build the project
- Run the application
- Access the application
- Open browser and go to:
https://localhost:5001 (or http://localhost:5000)
- Database will be auto-created on first run
π€ Default Credentials
Admin Account
- Email: admin@neitfoods.com
- Password: Admin@123
Use these credentials to access the admin dashboard at /Admin/Dashboard
ποΈ Test Data
The application comes pre-populated with:
- 2 Product Categories (Nuts, Dried Fruits)
- 10 Sample Products with descriptions and prices
- 1 Admin User account
π³ Checkout Process
- Add to Cart - Click βAdd to Cartβ on any product
- Review Cart - View
/Cart to see items and quantities
- Checkout - Click βProceed to Checkoutβ
- Shipping Details - Enter/verify phone and address
- Order Confirmation - View order details with tracking number
- Estimated Delivery - Shows 5 days from order date
π Admin Dashboard
Access admin panel at /Admin (requires admin login):
- Dashboard - View key metrics and recent orders
- Products - Add, edit, or delete products
- Orders - View and manage customer orders
- Analytics - See revenue, customer count, and inventory
π¨ Features Highlight
Search & Filtering
- Real-time product search
- Category filtering
- Sorting options (price, rating, newest)
Product Details
- Star ratings (1-5)
- Customer reviews
- Stock information
- Add review functionality
User Experience
- Responsive design (mobile-friendly)
- Professional styling with gradients
- Clear call-to-action buttons
- Fast checkout process
Security
- Password hashing with SHA256
- Session-based authentication
- CSRF protection with Anti-Forgery tokens
- Secure form submissions
π Order Status Flow
Orders follow this status progression:
- Pending - Order received, awaiting processing
- Processing - Order is being prepared
- Shipped - Order on the way
- Delivered - Order delivered
Admin can update order status from the Orders management page.
π° Pricing
Sample product prices (in βΉ):
- Almonds: βΉ899
- Cashews: βΉ999
- Dates: βΉ799
- Walnuts: βΉ1099
- Pistachios: βΉ1299
- Raisins: βΉ699
π± Responsive Design
The entire website is responsive and works on:
- Desktop (1200px+)
- Tablet (768px - 1199px)
- Mobile (less than 768px)
π Authentication & Authorization
- Users must register or login to place orders
- Admin login required for admin dashboard
- Session tokens used for security
- Password stored as SHA256 hash
π― Future Enhancements
Potential features to add:
- Payment gateway integration (Stripe, PayPal)
- Email notifications for orders
- Wishlist functionality
- Product recommendations
- Discount coupons
- User reviews and ratings
- Multiple address management
- Order history
- Return management
- Inventory alerts
π Notes
- SQLite database auto-creates on first run
- Images are stored in
/wwwroot/images/products/
- Session timeout: 30 minutes
- Cart persists per user (logged in or guest)
- Products with 0 stock show as βOut of Stockβ
π Troubleshooting
Database not creating:
- Run
dotnet ef database update
Images not loading:
- Ensure
/wwwroot/images/products/ directory exists
Login not working:
- Verify admin user exists in database
- Check password is correct (case-sensitive)
Session expires:
- Session timeout is set to 30 minutes
- Login again if session expires
π License
This project is created for educational purposes.
Version: 1.0
Last Updated: August 2024
Status: β
Production Ready