Fix message
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 34s

This commit is contained in:
Maxime Adler
2025-04-10 15:21:13 +02:00
parent 797484525b
commit b545da19b7
3 changed files with 6 additions and 13 deletions

View File

@@ -1,7 +1,3 @@
namespace GameIdeas.Shared.Exceptions;
public class NotFoundException : Exception
{
public NotFoundException(string msg, Exception? innerException = null) : base(msg, innerException)
{ }
}
public class NotFoundException(string msg, Exception? innerException = null) : Exception(msg, innerException);

View File

@@ -10,8 +10,8 @@ namespace GameIdeas.WebAPI.Controllers;
public class GameController(GameService gameService) : Controller
{
[HttpGet("Search")]
public async Task<IEnumerable<GameDto>> FetchGames([FromQuery] GameFilterDto filter)
public async Task<IEnumerable<GameDto>> FetchGames([FromQuery] PaggingDto pagging)
{
return await gameService.GetGames(filter);
return await gameService.GetGames(pagging);
}
}

View File

@@ -42,12 +42,9 @@ public class GameService(GameIdeasContext context, IMapper mapper)
.Include(g => g.GameDevelopers).ThenInclude(p => p.Developer)
.FirstOrDefaultAsync(g => g.Id == gameId);
if (game == null)
{
throw new NotFoundException($"[{typeof(Game).Name}] with ID {gameId} has not been found in context");
}
return mapper.Map<GameDto>(game);
return game == null
? throw new NotFoundException($"[{typeof(Game).Name}] with ID {gameId} has not been found in context")
: mapper.Map<GameDto>(game);
}
public async Task<GameDto> CreateGame(GameDto gameDto)