🥅 catching 'No Content' error

Co-authored-by: haraldnilsen <harald_998@hotmail.com>
This commit is contained in:
Sindre Kjelsrud 2023-09-19 11:21:13 +02:00
parent 6ef2a4f8af
commit a2557d2201

View file

@ -29,6 +29,10 @@ public class MovieController: ControllerBase
IEnumerable<MovieDB> resultSkip = movies.Skip(pageSize * (pageNumber - 1));
IEnumerable<MovieDB> resultTake = resultSkip.Take(pageSize);
if (resultTake.ToList().Count == 0) {
return StatusCode(204, "No Content");
}
return Ok(resultTake);
}
catch (Exception ex)