Finished project β
-
.NET 6.0 or +
-
Connection string to SQLServer in MoviesApi/appsettings.json named as Default
Create a database in SQLServer that contains the table created from the following script:
CREATE TABLE [Movies] (
[Id] int NOT NULL IDENTITY,
[Title] nvarchar(255) NULL,
[Genre] nvarchar(20) NULL,
[ReleaseDate] datetime2 NOT NULL,
CONSTRAINT [PK_Movies] PRIMARY KEY ([Id])
);
GO
CREATE TABLE [Stars] (
[Id] int NOT NULL IDENTITY,
[Name] nvarchar(80) NOT NULL,
[Surname] nvarchar(80) NOT NULL,
[Nationality] nvarchar(50) NULL,
[BirthDate] datetime2 NOT NULL,
[WonOscar] bit NOT NULL,
CONSTRAINT [PK_Stars] PRIMARY KEY ([Id])
);
GO
$ git clone https://github.com/lcsmota/MoviesApi.git
$ cd MoviesApi/
$ dotnet restore
$ dotnet run
Server listenning at https://localhost:7267/swagger or https://localhost:7267/api/v1/Movies and https://localhost:7267/api/v1/Stars
GET https://localhost:7267/api/v1/Movies
βοΈ Status Code:
(200) - OK
GET https://localhost:7267/api/v1/Movies/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Mandatory. The ID of the object you want to view |
βοΈ Status Code:
(200) - OK
(404) - Not Found
POST https://localhost:7267/api/v1/Movies
π¨ body:
{
"title": "Pacific Rim",
"genre": "Science Fiction",
"releaseDate": "2013-07-12T13:09:54.105Z"
}
π§Ύ response:
{
"id": 8,
"title": "Pacific Rim",
"genre": "Science Fiction",
"releaseDate": "2013-07-12T13:09:54.105Z"
}
βοΈ Status Code:
(201) - Created
(400) - Bad Request
PUT https://localhost:7267/api/v1/Movies/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Mandatory. The ID of the object you want to update |
π¨ body:
{
"id": 8,
"title": "Pacific Rim",
"genre": "Science Fiction",
"releaseDate": "2013-07-12T13:09:54.105Z"
}
π§Ύ response:
βοΈ Status Code:
(204) - No Content
(400) - Bad Request
DELETE https://localhost:7267/api/v1/Movies/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Mandatory. The ID of the object you want to delete |
π¨ body:
π§Ύ response:
βοΈ Status Code:
(204) - No Content
(404) - Not Found
GET https://localhost:7267/api/v1/Stars
βοΈ Status Code:
(200) - OK
GET https://localhost:7267/api/v1/Stars/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Mandatory. The ID of the object you want to view |
βοΈ Status Code:
(200) - OK
(404) - Not Found
POST https://localhost:7267/api/v1/Stars
π¨ body:
{
"name": "Charles",
"surname": "Hunnam",
"nationality": "English",
"birthDate": "1980-04-10T13:40:58.735Z",
"wonOscar": false
}
π§Ύ response:
{
"id": 4,
"name": "Charles",
"surname": "Hunnam",
"nationality": "English",
"birthDate": "1980-04-10T13:40:58.735Z",
"wonOscar": false
}
βοΈ Status Code:
(201) - Created
(400) - Bad Request
PUT https://localhost:7267/api/v1/Stars/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Mandatory. The ID of the object you want to update |
π¨ body:
{
"id": 4,
"name": "Charles",
"surname": "Hunnam",
"nationality": "English",
"birthDate": "1980-04-10T13:40:58.735Z",
"wonOscar": false
}
π§Ύ response:
βοΈ Status Code:
(204) - No Content
(400) - Bad Request
DELETE https://localhost:7267/api/v1/Stars/${id}
Parameter | Type | Description |
---|---|---|
id |
int |
Mandatory. The ID of the object you want to delete |
π¨ body:
π§Ύ response:
βοΈ Status Code:
(204) - No Content
(404) - Not Found
- C# 10
- .NET CORE 6
- SQL SERVER
- Entity Framework 7
- Code First
- Swagger
- Fluent Validation
- Repository Pattern
- Unit Of Work Pattern
- Dependency injection
- POO
Registration, Listing, Update and Removal