Skip to content

anhvuong123/ecommerce_web

Repository files navigation

Pre-Condition: Download and Install .NET 8 SDK

You can download and install the .NET 8 SDK from the following link:
Download .NET 8 SDK

(Restore Backup DB)

Step 1: Restore DB

Open your SQL Server and restore the backup DB from DB_Backup folder (for easy to get sample data in the Assessment, then you can create/edit data from admin page <ecommerce_reactjs_admin>)

Step 2: Can pick sample user to work in WebEcommerceMVC (to login & vote product rating) and ecommerce_reactjs_admin (to manage information):

  1. WebEcommerceMVC

    user001/Kcs@222
  2. ecommerce_reactjs_admin

    vietanh/Kcs@222

Note: we have 2 roles (Basic User & Admin User) from AspNetRoles

(API project)

Step 1: Install packages

Open your terminal and navigate to your project directory. Run the following commands to install the necessary packages:

  1. Microsoft.AspNetCore.OpenApi

    dotnet add package Microsoft.AspNetCore.OpenApi --version 8.0.10
  2. Swashbuckle.AspNetCore

    dotnet add package Swashbuckle.AspNetCore --version 6.6.2
  3. Entity Framework Core SQL Server 8.0.0:

    dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 8.0.0
  4. Entity Framework Core Tools 8.0.0:

    dotnet add package Microsoft.EntityFrameworkCore.Tools --version 8.0.0
  5. IdentityServer4.AspNetIdentity:

    dotnet add package IdentityServer4.AspNetIdentity --version 4.0.0
  6. Microsoft.AspNetCore.Identity.EntityFrameworkCore:

    dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore --version 8.0.0
  7. Microsoft.AspNetCore.Authentication.JwtBearer:

    dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer --version 8.0.0
  8. System.IdentityModel.Tokens.Jwt:

    dotnet add package System.IdentityModel.Tokens.Jwt --version 8.0.0

Step 2: Update the Database Connection String

To configure the database connection, open the appsettings.json file and update the connection string to align with your SQL Server instance.

Connection String Explanation:

The connection string format consists of key-value pairs that define how your application connects to the database. Here’s an example connection string and a breakdown of its components:

"ConnectionStrings": {
    "DefaultConnection": "Server=VNNOT0123\\MSSQLSERVER0123;Database=EcommerceDB;Trusted_Connection=True;TrustServerCertificate=True"
}
  • Server: This specifies the SQL Server instance to connect to. In this example, VNNOT0123\\MSSQLSERVER0123 refers to the server name and instance name.
  • Database: This specifies the name of the database to use, which in this case is EcommerceDB.
  • Trusted_Connection: Setting this to True enables Windows Authentication. If you use SQL Server Authentication, you need to provide a username and password instead.
  • TrustServerCertificate: This setting is used to indicate whether the application should trust the server's SSL certificate. Set it to True if you want to ignore SSL certificate errors (generally not recommended for production environments).

Step 3: Add class library

dotnet add reference ../../ClassLib/EcommerceLib/EcommerceLib.csproj

Step 4: Build & Run the Project

To start the application, use one of the following commands in your terminal:

  • Build the project:

    dotnet build
  • Run the project:

    dotnet run
    • Run the project in watch mode & get Swagger API (automatically restarts on file changes):
    dotnet watch run

Once the project is running, you can access it in your web browser at https://localhost:<port>/.

(EcomerceWebMVC project)

Step 1: Add class library

Open your terminal and navigate to your project directory. Run the following commands to add necessary class library:

dotnet add reference ../ClassLib/EcommerceLib/EcommerceLib.csproj

Step 2: Build & Run the Project

To start the application, use one of the following commands in your terminal:

  • Build the project:

    dotnet build
  • Run the project:

    dotnet run
  • Run the project in watch mode (automatically restarts on file changes):

    dotnet watch run

Once the project is running, you can access it in your web browser at https://localhost:<port>/.

(ecommerce_reactjs_admin project)

Step 1: Install packages

Open your terminal and navigate to your project directory. Run the following commands to install the necessary packages:

npm install axios react-router-dom react-bootstrap bootstrap 

Step 2: Build & Run the Project

To start the application, use one of the following commands in your terminal:

  • Build the project:
    npm start

Once the project is running, you can access it in your web browser at https://localhost:<port>/.

(Sample API , UI <EcommerceWebMVC & ecommerce_reactjs_admin project>)

Swagger API:

image

Ecommerce - ASP.NET Core MVC:

image

Ecommerce - ReactJS (for Admin):

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages