Fix message
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 34s
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 34s
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user