diff --git a/backend/Controllers/MovieController.cs b/backend/Controllers/MovieController.cs index c1befae..2dc8e4e 100644 --- a/backend/Controllers/MovieController.cs +++ b/backend/Controllers/MovieController.cs @@ -16,9 +16,30 @@ public class MovieController: ControllerBase _context = context; } - [HttpGet(Name = "GetMovie")] - public IEnumerable Get() + [HttpGet(Name = "GetMovies")] + public ActionResult> Get([FromQuery]int pageNumber = 1, [FromQuery] int pageSize = 5) { - return _context.Movies.ToList(); + try + { + var movies = _context.Movies.ToList(); + return Ok(movies); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error fetching movies"); + return StatusCode(500, "Internal server error"); + } } + + // [HttpPost(Name = "PostMovie")] + // public ActionResult<> Post([FromQuery] string movieTitle) { + // try + // { + + // } + // catch (Exception ex) + // { + + // } + // } } \ No newline at end of file