Backend Setup

Getting started

Step 1: Once you extract the downloaded file you can see these folders.

Step 2: Open the NETAdminLTEWeb folder and double click on NETAdminLTEWeb.sln file to open it in Visual Studio 2022

To understand the project structure click this

Step 3: Once it opened you can see the projects in the Solution Explorer

Changing the connection string

Step 1: Click and expand NETAdminLTEWeb and open appsettings.json file to change the db connection string.

Step 2: Now we'll change the connection string in the API project also. To do that click and expand the NETAdminLTEApi project and open appsettings.json and paste the same connection string here.

Note: If you want to change the JWT Secret key change the "Secret" value with your own

Running migration

To create a migration file by using Package Manager Console and apply it to the database follow these steps.

Step 1: Select Tools -> Nuget Package manager -> Package Manager Console this will open the Package Manager console.

Step 2: Click on the default project dropdown and choose AdminLTEDataAccess for running the migration command

Step 3: Type this command to generate the migration script

add-migration

Step 4: Once it successfully generates the migration fine you can see this output and a folder in the NETAdminLTEDataAccess project

If you get an error like the given name already exists delete the entire migration folder in AdminLTEDataAccess->Migration

Step 5: Then run this command to run the migration script to create the database and its table

update-database

Step 6: Once it successfully updates you can see this output and also the database will be created in MSSql Server

If you use MSSQL Server you can use SQL Management Studio to make sure that the database is created.

Running the Admin Panel

Step 1: To run the project for the first time select the highlighted option.

Step 2: Once it launches a browser will open and you can see this login page

Seeding demo data

Step 1: To seed the demo data. Click on the Seed demo data button. Once it's done you can see this success message.

If you want to update the demo account details. See this section

Login into the Admin Panel

Step 1: To log in with the default admin credential. Use below credentials

Admin Account:

UserName: adminuser

Password: Admin@123

Step 2: Once you login you can see the dashboard

Running the API Project

Step 1: To run the API project select the NETAdminLTEApi from the project selection dropdown

Step 2: Click on the run button to launch the API project

If you choose IIS Express then it will launch the API project with swagger UI in your default browser for testing the endpoints locally.

If you choose the Flutter Test Launching profile then your flutter app can communicate this endpoint using your local IP (ex: your 192.168.10.1:44317/api/v1).

Step 3: Once it successfully launches you can see this screen

Here we're testing the endpoints using the build swagger UI, you can use any API testing tools (ex: postman). If you select the Flutter Test launch profile then this browser window will not auto-launch, you may have to manually open your browser and go to the ip:44317/swagger to access it.

Last updated