Aron-HD / asp-dotnet-webapi

CRUD API built with ASP.NET Core webapi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C# MicrosoftSQLServer Postman

A C# Web CRUD API using ASP.NET Core and SQL Server 2019 & SQL Server Management Studio, with Entity Framework Core as ORM, that stores CLI commands for different platforms.

Credit: Les Jackson
Repo: binarythistle

Routes

HTTP Method Function Endpoint Completed
POST Create a Command /api/commands Y
GET Read all Commands /api/commands Y
GET Read Command by ID /api/commands/{id} Y
PUT Replace Command by ID /api/commands/{id} Y
PATCH Update Command by ID /api/commands/{id} Y
DELETE Delete Command by ID /api/commands/{id} Y

User secrets

Password for db set with:

dotnet user-secrets init
dotnet user-secrets set "<secret key>" "<secret value>"
dotnet user-secrets list

Added to startup before DbContext:

var builder = new SqlConnectionStringBuilder(
    Configuration.GetConnectionString("CommanderConnection")
);
builder.Password = Configuration.GetSection("DBPassword").Value;
var connectionString = builder.ConnectionString;

services.AddDbContext<CommanderContext>(opt => opt.UseSqlServer(connectionString));

About

CRUD API built with ASP.NET Core webapi.


Languages

Language:C# 100.0%