/ProductAPI

CRUD WebAPI App with .NET 6

Primary LanguageC#

ProductAPI

CRUD WebAPI App with .NET 6 and Swagger API documentation.

Description

  • This Web API app is demonstration of CRUD operations with Swagger API documentation for testing APIs.
  • Technology used - C#, .NET 6 and Swashbuckle nuget package.

How to Install and Run the Project on your environment?

  1. Clone the project on local directory.

image

  1. Go to Solution view from Solution Explorer

image

  1. Go to appsettings.json file and copy the ConnectionStrings object
   "ConnectionStrings": {
     "SqlServerConnection": "server=\\LocalDBServer;database=productsdb;TrustServerCertificate=True;Integrated Security=SSPI"
   } 
  1. Go to ProductAPI Project and right click on it and select Manage User Secrets

image

  1. paste the ConnectionStrings object in Secrets json file.
   "ConnectionStrings": {
     "SqlServerConnection": "server=\\LocalDBServer;database=productsdb;TrustServerCertificate=True;Integrated Security=SSPI"
   }  
  1. Create database with name 'productsdb' in your SQL Server instance and add Server name and database name in secrets.json

image

  1. Now Open Package Manager Console

image

  1. Then you need to install Entity Framework Core CLI, so perform below command in Package Manager Console.
dotnet tool install --global dotnet-ef
  1. Then you need to update changes for database tables to your SQL Server instance, so perform below command in Package Manager Console.
dotnet ef database update --project ProductAPI
  1. With successfull configuration, now simply select launch type for running project an run the project with F5 key.

image

  1. Now project will be running in browser with swagger API documentation page.

image