From cc7bb34302505400034587746d595ad4ba47f209 Mon Sep 17 00:00:00 2001 From: haraldnilsen Date: Fri, 15 Sep 2023 10:42:46 +0200 Subject: [PATCH] :heavy_plus_sign: added EF dependencies Co-authored-by: Sindre Kjelsrud --- backend/Controllers/MovieController.cs | 29 ++++++++++++++++++++++++++ backend/{ => Models}/Movie.cs | 2 ++ backend/{ => Models}/MovieResponse.cs | 2 +- backend/backend.csproj | 5 +++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 backend/Controllers/MovieController.cs rename backend/{ => Models}/Movie.cs (92%) rename backend/{ => Models}/MovieResponse.cs (84%) diff --git a/backend/Controllers/MovieController.cs b/backend/Controllers/MovieController.cs new file mode 100644 index 0000000..b58c0a8 --- /dev/null +++ b/backend/Controllers/MovieController.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Mvc; + +namespace backend.Controllers; + +[ApiController] +[Route("[controller]")] +public class MovieController: ControllerBase +{ + private readonly ILogger _logger; + + public MovieController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetMovie")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new Movie + { + Title = "Title", + Year = "Year", + imdbID = "imdbID", + Type = "Type", + Poster = "Poster" + }) + .ToArray(); + } +} \ No newline at end of file diff --git a/backend/Movie.cs b/backend/Models/Movie.cs similarity index 92% rename from backend/Movie.cs rename to backend/Models/Movie.cs index 537e11f..a48508e 100644 --- a/backend/Movie.cs +++ b/backend/Models/Movie.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace backend; public class Movie diff --git a/backend/MovieResponse.cs b/backend/Models/MovieResponse.cs similarity index 84% rename from backend/MovieResponse.cs rename to backend/Models/MovieResponse.cs index dd207cc..58e8526 100644 --- a/backend/MovieResponse.cs +++ b/backend/Models/MovieResponse.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +#nullable disable namespace backend; diff --git a/backend/backend.csproj b/backend/backend.csproj index d2f5cb0..2f0ded7 100644 --- a/backend/backend.csproj +++ b/backend/backend.csproj @@ -8,6 +8,11 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + +