This repository was developed to learn how to create a CRUD in C# in version 5.0 of .NET using clean architecture following the playlist https://www.youtube.com/playlist?list=PLbq2QKd5ieAt0H551D_0E4bGIYRxbq5HL by Francis Silveira Andrade on YouTube
GET — "/api/Pokemons"
Get all Pokemons
response:
[
{
"id": int,
"tipo": string,
"nome": string,
"poder": double,
"dataCriacao"?: DateTime,
"dataAtualizacao"?: DateTime
}
]
POST — "/api/Pokemons"
Create a new Pokemon
body:
{
"tipo": string,
"nome": string,
"poder": double
}
response:
{
"id": int,
"tipo": string,
"nome": string,
"poder": double,
"dataCriacao": DateTime,
"dataAtualizacao": null
}
PUT — "/api/Pokemons"
Update an existing Pokemon by your id
body:
{
"tipo": string,
"nome": string,
"poder": double,
"id": int
}
response:
{
"id": int,
"tipo": string,
"nome": string,
"poder": double,
"dataCriacao": DateTime,
"dataAtualizacao": DateTime
}
GET — "/api/Pokemons/{ id }"
Get a specific Pokemon by your id
route params:
id: int
response:
{
"id": int,
"tipo": string,
"nome": string,
"poder": double,
"dataCriacao": DateTime,
"dataAtualizacao"?: DateTime
}
DELETE — "/api/Pokemons/{ id }"
Delete a Pokemon by your id
route params:
id: int
Finished project ✅
.NET 5.0
Connection string to SQL Server BD in app-charp/AP.Api/appsettings.json named as "APConnection"
$ git clone https://github.com/AllanDutra/pokemon-crud.git
$ cd pokemon-crud/AP.Api
$ dotnet ef database update -p ../AP.Data/AP.Data.csproj -s ./AP.Api.csproj
$ dotnet run
Server listenning at https://localhost:5001/!