https://github.com/timothyjan/janshopper
Full-stack e-commerce web application using Angular for a responsive front-end, ASP.NET Core for a RESTful API, and SQL Server for database management, featuring user authentication, product CRUD operations, shopping cart functionality, and order tracking.
https://github.com/timothyjan/janshopper
Last synced: 9 months ago
JSON representation
Full-stack e-commerce web application using Angular for a responsive front-end, ASP.NET Core for a RESTful API, and SQL Server for database management, featuring user authentication, product CRUD operations, shopping cart functionality, and order tracking.
- Host: GitHub
- URL: https://github.com/timothyjan/janshopper
- Owner: TimothyJan
- Created: 2025-02-19T17:57:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-11T20:26:39.000Z (about 1 year ago)
- Last Synced: 2025-07-26T17:44:16.906Z (10 months ago)
- Language: C#
- Size: 15.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JanShopper
Full-stack e-commerce web application using Angular for a responsive front-end, ASP.NET Core for a RESTful API, and SQL Server for database management, featuring user authentication, product CRUD operations, shopping cart functionality, and order tracking.
Process:
- SQL Server Management Studio
- Connect to Server
- Server Type: Database Engine
- Server Name: localhost
- Authentication: Windows Authentication
- Connect
- Create a new Database
- In the Object Explorer, right-click on Databases and select New Database
- Database Name: JanShopperDb
- In the Object Explorer, right-click on Databases and select New Database
- Configure a User
- Expand the Security node.
- Right-click Logins and select New Login
- In the Login - New dialog:
- Login Name: Enter a username
- Authentication: Choose SQL Server Authentication and set a password.
- In the left panel, go to User Mapping, check your database (JanShopperDb), and assign the db_owner role.
- Configure the Connection String in appsettings.json
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=JanShopperDb;User Id=youUserId;Password=yourPassword;Trusted_Connection=True;"
- Connect to Server
- Create ASP.NET Core API
- Add Required NuGet Packages
Microsoft.EntityFrameworkCoreMicrosoft.EntityFrameworkCore.SqlServerMicrosoft.EntityFrameworkCore.Tools- For password hashing in UserRepository: Install BCrypt.Net: ~
Install-Package BCrypt.Net-Next
- Create Models(User, Category, Product) with data annotations.
- Create DTOs to transfer only the required data between the client and server.
- User
- UserRegistrationDTO for write operations where validation is critical.
- UserProfileDTO for read operations where validation is not needed.
- Create Database Context JanShopperDbContext. The DbContext simplifies database interactions, manages entities and their relationships, and ensures data consistency.
- Create Repositories and IRepositories(Interface) for each model with async methods to abstract data access logic, promotes separation of concerns, and makes the code cleaner, more maintainable, and easier to test.
- Create Controllers for each model to handle incoming HTTP requests, process the HTTP requests, and return appropriate responses.
- Configure Program.cs to use connection string to SQL Server.
- Create migrations and apply to the database to create tables.
- ~
dotnet ef migrations add InitialCreate - ~
dotnet ef database update
- ~
- Seed database with dummy data.
- Create SeedData.cs.
- Modify Program.cs to call the
SeedData.Initializemethod during application startup. - Add migrations and apply to the database to create tables.
- Add Migration: ~
dotnet ef migrations add SeedDataMigration - Apply Migration: ~
dotnet ef database update
- Add Migration: ~
- Clean and Recreate Database (Development Only)
- ~
dotnet ef database drop - ~
dotnet ef migrations remove - ~
dotnet ef migrations add InitialCreate - ~
dotnet ef database update
- ~
- Test all methods on Swagger.
-
- Add Required NuGet Packages
Database Schema
- User:
Id, UserName, Email, Password - Category:
Id, Name - Product:
Id, Name, Description, Price, Stock, CategoryId - Order:
Id, UserId, OrderDate, TotalAmount, Status - OrderItems:
Id, OrderId, ProductId, Quantity, Price - Payment:
Id, OrderId, PaymentDate, Amount, PaymentMethod