Add frontend creation game (#13)

Reviewed-on: #13
This commit was merged in pull request #13.
This commit is contained in:
2025-04-13 17:21:15 +02:00
parent 3ea96186e7
commit 225e8ba140
60 changed files with 913 additions and 231 deletions

View File

@@ -0,0 +1,28 @@
using AutoMapper;
using GameIdeas.Shared.Dto;
using GameIdeas.WebAPI.Context;
using GameIdeas.WebAPI.Services.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace GameIdeas.WebAPI.Services;
public class CategoryService(GameIdeasContext context, IMapper mapper) : ICategoryService
{
public async Task<CategoriesDto> GetCategories()
{
var platforms = await context.Platforms.ToListAsync();
var properties = await context.Properties.ToListAsync();
var tags = await context.Tags.ToListAsync();
var developers = await context.Developers.ToListAsync();
var publishers = await context.Publishers.ToListAsync();
return new()
{
Platforms = mapper.Map<IEnumerable<PlatformDto>>(platforms),
Properties = mapper.Map<IEnumerable<PropertyDto>>(properties),
Tags = mapper.Map<IEnumerable<TagDto>>(tags),
Developers = mapper.Map<IEnumerable<DeveloperDto>>(developers),
Publishers = mapper.Map<IEnumerable<PublisherDto>>(publishers)
};
}
}

View File

@@ -3,11 +3,12 @@ using GameIdeas.Shared.Dto;
using GameIdeas.Shared.Exceptions;
using GameIdeas.Shared.Model;
using GameIdeas.WebAPI.Context;
using GameIdeas.WebAPI.Services.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace GameIdeas.WebAPI.Services;
public class GameService(GameIdeasContext context, IMapper mapper)
public class GameService(GameIdeasContext context, IMapper mapper) : IGameService
{
public async Task<IEnumerable<GameDto>> GetGames(PaggingDto pagging)
{

View File

@@ -0,0 +1,8 @@
using GameIdeas.Shared.Dto;
namespace GameIdeas.WebAPI.Services.Interfaces;
public interface ICategoryService
{
Task<CategoriesDto> GetCategories();
}

View File

@@ -0,0 +1,12 @@
using GameIdeas.Shared.Dto;
namespace GameIdeas.WebAPI.Services.Interfaces;
public interface IGameService
{
Task<IEnumerable<GameDto>> GetGames(PaggingDto pagging);
Task<GameDto> GetGameById(int gameId);
Task<GameDto> CreateGame(GameDto gameDto);
Task<GameDto> UpdateGame(GameDto gameDto);
Task<bool> DeleteGame(int gameId);
}

View File

@@ -1,5 +0,0 @@
namespace GameIdeas.WebAPI.Services;
public class UserService
{
}