➕ added EF dependencies
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
f1455d7ee3
commit
cc7bb34302
4 changed files with 37 additions and 1 deletions
29
backend/Controllers/MovieController.cs
Normal file
29
backend/Controllers/MovieController.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace backend.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class MovieController: ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ILogger<MovieController> _logger;
|
||||||
|
|
||||||
|
public MovieController(ILogger<MovieController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet(Name = "GetMovie")]
|
||||||
|
public IEnumerable<Movie> Get()
|
||||||
|
{
|
||||||
|
return Enumerable.Range(1, 5).Select(index => new Movie
|
||||||
|
{
|
||||||
|
Title = "Title",
|
||||||
|
Year = "Year",
|
||||||
|
imdbID = "imdbID",
|
||||||
|
Type = "Type",
|
||||||
|
Poster = "Poster"
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
namespace backend;
|
namespace backend;
|
||||||
|
|
||||||
public class Movie
|
public class Movie
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
#nullable disable
|
||||||
|
|
||||||
namespace backend;
|
namespace backend;
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.11">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
Reference in a new issue