feature/apply-filter (#18)
Co-authored-by: Maxime Adler <madler@sqli.com> Reviewed-on: #18
This commit was merged in pull request #18.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using GameIdeas.Shared.Dto;
|
||||
using GameIdeas.WebAPI.Services.Interfaces;
|
||||
using GameIdeas.WebAPI.Services.Categories;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace GameIdeas.WebAPI.Controllers;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using GameIdeas.Shared.Dto;
|
||||
using GameIdeas.WebAPI.Services.Interfaces;
|
||||
using GameIdeas.WebAPI.Services.Games;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace GameIdeas.WebAPI.Controllers;
|
||||
@@ -7,16 +7,19 @@ namespace GameIdeas.WebAPI.Controllers;
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
|
||||
public class GameController(IGameService gameService, ILoggerFactory loggerFactory) : Controller
|
||||
public class GameController(
|
||||
IGameReadService gameReadService,
|
||||
IGameWriteService gameWriteService,
|
||||
ILoggerFactory loggerFactory) : Controller
|
||||
{
|
||||
private readonly ILogger<GameController> logger = loggerFactory.CreateLogger<GameController>();
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<GameDto>>> GetGames([FromQuery] PaggingDto pagging)
|
||||
public async Task<ActionResult<IEnumerable<GameDto>>> SearchGames([FromQuery] GameFilterDto filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(await gameService.GetGames(pagging));
|
||||
return Ok(await gameReadService.GetGames(filter));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -26,11 +29,11 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto
|
||||
}
|
||||
|
||||
[HttpGet("{id:int}")]
|
||||
public async Task<ActionResult<GameDto>> GetGameById(int id)
|
||||
public async Task<ActionResult<GameDetailDto>> GetGameById(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(await gameService.GetGameById(id));
|
||||
return Ok(await gameReadService.GetGameById(id));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -40,11 +43,11 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto
|
||||
}
|
||||
|
||||
[HttpPost("Create")]
|
||||
public async Task<ActionResult<int>> CreateGame([FromBody] GameDto game)
|
||||
public async Task<ActionResult<int>> CreateGame([FromBody] GameDetailDto game)
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameResult = await gameService.CreateGame(game);
|
||||
var gameResult = await gameWriteService.CreateGame(game);
|
||||
return Created("/Create", gameResult.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -55,11 +58,11 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto
|
||||
}
|
||||
|
||||
[HttpPut("Update")]
|
||||
public async Task<ActionResult<int>> UpdateGame([FromBody] GameDto game)
|
||||
public async Task<ActionResult<int>> UpdateGame([FromBody] GameDetailDto game)
|
||||
{
|
||||
try
|
||||
{
|
||||
var gameResult = await gameService.UpdateGame(game);
|
||||
var gameResult = await gameWriteService.UpdateGame(game);
|
||||
return Created($"/Update", gameResult.Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -74,7 +77,7 @@ public class GameController(IGameService gameService, ILoggerFactory loggerFacto
|
||||
{
|
||||
try
|
||||
{
|
||||
return Ok(await gameService.DeleteGame(id));
|
||||
return Ok(await gameWriteService.DeleteGame(id));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
"StorageSizeMo": "Taille d'espace en Mo",
|
||||
"LastModification": "Dernière modifications",
|
||||
"ReleaseDate": "Date de parution",
|
||||
"CreateDate": "Date de création",
|
||||
"UpdateDate": "Date de modification",
|
||||
"Title": "Titre",
|
||||
"Interest": "Intérêt",
|
||||
"Properties": "Propriétés",
|
||||
@@ -35,6 +37,11 @@
|
||||
"InvalidTitle": "Le titre est incorrect",
|
||||
"InvalidInterest": "L'interêt est incorrect",
|
||||
"Unknown": "Inconnu",
|
||||
"ErrorFetchGames": "Erreur lors de la récupération des jeux"
|
||||
|
||||
"ErrorFetchGames": "Erreur lors de la récupération des jeux",
|
||||
"Ascending": "Ascendant",
|
||||
"Descending": "Descendant",
|
||||
"ErrorStorageSpaceLabel": "Erreur lors de la génération des label de l'espace de stockage",
|
||||
"MinStorageSpaceFormat": "Jusqu'à {0}",
|
||||
"MaxStorageSpaceFormat": "Plus de {0}",
|
||||
"MinMaxStorageSpaceFormat": "{0} à {1}"
|
||||
}
|
||||
@@ -8,16 +8,14 @@ public class GameProfile : Profile
|
||||
{
|
||||
public GameProfile()
|
||||
{
|
||||
CreateMap<Game, GameDto>()
|
||||
CreateMap<Game, GameDetailDto>()
|
||||
.ForMember(d => d.Id, o => o.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.Title, o => o.MapFrom(s => s.Title))
|
||||
.ForMember(d => d.ReleaseDate, o => o.MapFrom(s => s.ReleaseDate))
|
||||
.ForMember(d => d.CreationDate, o => o.MapFrom(s => s.CreationDate))
|
||||
.ForMember(d => d.CreationUserId, o => o.MapFrom(s => s.CreationUserId))
|
||||
.ForMember(d => d.CreationUser, o => o.MapFrom(s => s.CreationUser))
|
||||
.ForMember(d => d.ModificationDate, o => o.MapFrom(s => s.ModificationDate))
|
||||
.ForMember(d => d.ModificationUserId, o => o.MapFrom(s => s.ModificationUserId))
|
||||
.ForMember(d => d.ModificationUser, o => o.MapFrom(s => s.ModificationUser))
|
||||
.ForMember(d => d.StorageSpace, o => o.MapFrom(s => s.StorageSpace))
|
||||
.ForMember(d => d.Description, o => o.MapFrom(s => s.Description))
|
||||
.ForMember(d => d.Interest, o => o.MapFrom(s => s.Interest))
|
||||
@@ -27,5 +25,15 @@ public class GameProfile : Profile
|
||||
.ForMember(d => d.Publishers, o => o.MapFrom(s => s.GamePublishers.Select(p => p.Publisher)))
|
||||
.ForMember(d => d.Developers, o => o.MapFrom(s => s.GameDevelopers.Select(gd => gd.Developer)))
|
||||
.ReverseMap();
|
||||
|
||||
CreateMap<Game, GameDto>()
|
||||
.ForMember(d => d.Id, o => o.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.Title, o => o.MapFrom(s => s.Title))
|
||||
.ForMember(d => d.ReleaseDate, o => o.MapFrom(s => s.ReleaseDate))
|
||||
.ForMember(d => d.Platforms, o => o.MapFrom(s => s.GamePlatforms.Select(p => new PlatformDto() { Id = p.Platform.Id, Label = p.Platform.Label, Url = p.Url })))
|
||||
.ForMember(d => d.Tags, o => o.MapFrom(s => s.GameTags.Select(t => t.Tag)))
|
||||
.ForMember(d => d.StorageSpace, o => o.MapFrom(s => s.StorageSpace))
|
||||
.ForMember(d => d.Interest, o => o.MapFrom(s => s.Interest))
|
||||
.ReverseMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using GameIdeas.Resources;
|
||||
using GameIdeas.WebAPI.Context;
|
||||
using GameIdeas.WebAPI.Profiles;
|
||||
using GameIdeas.WebAPI.Services;
|
||||
using GameIdeas.WebAPI.Services.Interfaces;
|
||||
using GameIdeas.WebAPI.Services.Categories;
|
||||
using GameIdeas.WebAPI.Services.Games;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var services = builder.Services;
|
||||
@@ -32,7 +30,8 @@ services.AddDbContext<GameIdeasContext>(dbContextOptions);
|
||||
services.AddSingleton<TranslationService>();
|
||||
services.AddSingleton<Translations>();
|
||||
|
||||
services.AddScoped<IGameService, GameService>();
|
||||
services.AddScoped<IGameReadService, GameReadService>();
|
||||
services.AddScoped<IGameWriteService, GameWriteService>();
|
||||
services.AddScoped<ICategoryService, CategoryService>();
|
||||
|
||||
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
using AutoMapper;
|
||||
using GameIdeas.Shared.Dto;
|
||||
using GameIdeas.WebAPI.Context;
|
||||
using GameIdeas.WebAPI.Services.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GameIdeas.WebAPI.Services;
|
||||
namespace GameIdeas.WebAPI.Services.Categories;
|
||||
|
||||
public class CategoryService(GameIdeasContext context, IMapper mapper) : ICategoryService
|
||||
{
|
||||
public List<StorageSpaceDto> GetStorageSpaces() => [
|
||||
new() { Id = 1, MaxSize = 100 },
|
||||
new() { Id = 2, MinSize = 100, MaxSize = 1000 },
|
||||
new() { Id = 3, MinSize = 1000, MaxSize = 5000 },
|
||||
new() { Id = 4, MinSize = 5000, MaxSize = 10000 },
|
||||
new() { Id = 5, MinSize = 10000, MaxSize = 20000 },
|
||||
new() { Id = 6, MinSize = 20000, MaxSize = 40000 },
|
||||
new() { Id = 7, MinSize = 40000, MaxSize = 100000 },
|
||||
new() { Id = 8, MinSize = 100000 },
|
||||
];
|
||||
|
||||
public async Task<CategoriesDto> GetCategories()
|
||||
{
|
||||
var platforms = await context.Platforms.ToListAsync();
|
||||
@@ -15,6 +25,9 @@ public class CategoryService(GameIdeasContext context, IMapper mapper) : ICatego
|
||||
var tags = await context.Tags.ToListAsync();
|
||||
var developers = await context.Developers.ToListAsync();
|
||||
var publishers = await context.Publishers.ToListAsync();
|
||||
var releaseYears = await context.Games
|
||||
.Where(game => game.ReleaseDate != null)
|
||||
.Select(game => game.ReleaseDate!.Value.Year).Distinct().ToListAsync();
|
||||
|
||||
return new()
|
||||
{
|
||||
@@ -22,7 +35,9 @@ public class CategoryService(GameIdeasContext context, IMapper mapper) : ICatego
|
||||
Properties = mapper.Map<List<PropertyDto>>(properties),
|
||||
Tags = mapper.Map<List<TagDto>>(tags),
|
||||
Developers = mapper.Map<List<DeveloperDto>>(developers),
|
||||
Publishers = mapper.Map<List<PublisherDto>>(publishers)
|
||||
Publishers = mapper.Map<List<PublisherDto>>(publishers),
|
||||
ReleaseYears = mapper.Map<List<int>>(releaseYears),
|
||||
StorageSpaces = GetStorageSpaces()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using GameIdeas.Shared.Dto;
|
||||
|
||||
namespace GameIdeas.WebAPI.Services.Interfaces;
|
||||
namespace GameIdeas.WebAPI.Services.Categories;
|
||||
|
||||
public interface ICategoryService
|
||||
{
|
||||
List<StorageSpaceDto> GetStorageSpaces();
|
||||
Task<CategoriesDto> GetCategories();
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
using AutoMapper;
|
||||
using GameIdeas.Shared.Constants;
|
||||
using GameIdeas.Shared.Dto;
|
||||
using GameIdeas.Shared.Exceptions;
|
||||
using GameIdeas.Shared.Model;
|
||||
using GameIdeas.WebAPI.Context;
|
||||
using GameIdeas.WebAPI.Services.Categories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace GameIdeas.WebAPI.Services.Games;
|
||||
|
||||
public class GameReadService(GameIdeasContext context, IMapper mapper, ICategoryService categoryService) : IGameReadService
|
||||
{
|
||||
public async Task<IEnumerable<GameDto>> GetGames(GameFilterDto filter)
|
||||
{
|
||||
var query = context.Games
|
||||
.Include(g => g.GamePlatforms).ThenInclude(gp => gp.Platform)
|
||||
.Include(g => g.GameProperties)
|
||||
.Include(g => g.GameTags).ThenInclude(gt => gt.Tag)
|
||||
.Include(g => g.GamePublishers)
|
||||
.Include(g => g.GameDevelopers)
|
||||
.AsQueryable();
|
||||
|
||||
ApplyFilter(ref query, filter);
|
||||
|
||||
ApplyOrder(ref query, filter);
|
||||
|
||||
var games = await query.Skip((filter.CurrentPage - 1) * GlobalConstants.NUMBER_PER_PAGE)
|
||||
.Take(GlobalConstants.NUMBER_PER_PAGE)
|
||||
.ToListAsync();
|
||||
|
||||
ApplyStaticFilter(ref games, filter);
|
||||
|
||||
return mapper.Map<IEnumerable<GameDto>>(games);
|
||||
}
|
||||
|
||||
public async Task<GameDetailDto> GetGameById(int gameId)
|
||||
{
|
||||
var game = await context.Games
|
||||
.Include(g => g.CreationUser)
|
||||
.Include(g => g.ModificationUser)
|
||||
.Include(g => g.GamePlatforms).ThenInclude(p => p.Platform)
|
||||
.Include(g => g.GameProperties).ThenInclude(p => p.Property)
|
||||
.Include(g => g.GameTags).ThenInclude(p => p.Tag)
|
||||
.Include(g => g.GamePublishers).ThenInclude(p => p.Publisher)
|
||||
.Include(g => g.GameDevelopers).ThenInclude(p => p.Developer)
|
||||
.FirstOrDefaultAsync(g => g.Id == gameId);
|
||||
|
||||
return game == null
|
||||
? throw new NotFoundException($"[{typeof(Game).FullName}] with ID {gameId} has not been found in context")
|
||||
: mapper.Map<GameDetailDto>(game);
|
||||
}
|
||||
|
||||
private static void ApplyOrder(ref IQueryable<Game> query, GameFilterDto filter)
|
||||
{
|
||||
if (filter.SortType != null && filter.SortPropertyName != null)
|
||||
{
|
||||
var param = Expression.Parameter(typeof(Game), "x");
|
||||
Expression propertyAccess = Expression.PropertyOrField(param, filter.SortPropertyName);
|
||||
var converted = Expression.Convert(propertyAccess, typeof(object));
|
||||
var lambda = Expression.Lambda<Func<Game, object>>(converted, param);
|
||||
|
||||
if (filter.SortType == Shared.Enum.SortType.Ascending)
|
||||
{
|
||||
query = Queryable.OrderBy(query, lambda);
|
||||
}
|
||||
else
|
||||
{
|
||||
query = Queryable.OrderByDescending(query, lambda);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyFilter(ref IQueryable<Game> query, GameFilterDto filter)
|
||||
{
|
||||
if (filter.PlatformIds != null)
|
||||
{
|
||||
query = query.Where(game => filter.PlatformIds.All(plat =>
|
||||
game.GamePlatforms.Any(gp => gp.PlatformId == plat)));
|
||||
}
|
||||
|
||||
if (filter.PropertyIds != null)
|
||||
{
|
||||
query = query.Where(game => filter.PropertyIds.All(prop =>
|
||||
game.GameProperties.Any(gp => gp.PropertyId == prop)));
|
||||
}
|
||||
|
||||
if (filter.TagIds != null)
|
||||
{
|
||||
query = query.Where(game => filter.TagIds.All(tag =>
|
||||
game.GameTags.Any(gt => gt.TagId == tag)));
|
||||
}
|
||||
|
||||
if (filter.PublisherIds != null)
|
||||
{
|
||||
query = query.Where(game => filter.PublisherIds.All(pub =>
|
||||
game.GamePublishers.Any(gp => gp.PublisherId == pub)));
|
||||
}
|
||||
|
||||
if (filter.DeveloperIds != null)
|
||||
{
|
||||
query = query.Where(game => filter.DeveloperIds.All(dev =>
|
||||
game.GameDevelopers.Any(gd => gd.DeveloperId == dev)));
|
||||
}
|
||||
|
||||
if (filter.MinInterest != null)
|
||||
{
|
||||
query = query.Where(game => game.Interest >= filter.MinInterest);
|
||||
}
|
||||
|
||||
if (filter.MaxInterest != null)
|
||||
{
|
||||
query = query.Where(game => game.Interest <= filter.MaxInterest);
|
||||
}
|
||||
|
||||
if (filter.ReleaseYears != null)
|
||||
{
|
||||
query = query.Where(game => game.ReleaseDate != null &&
|
||||
filter.ReleaseYears.Contains(game.ReleaseDate.Value.Year));
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyStaticFilter(ref List<Game> games, GameFilterDto filter)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(filter.Title))
|
||||
{
|
||||
var keywords = filter.Title?
|
||||
.Split([' '], StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(k => k.Trim())
|
||||
.ToArray() ?? [];
|
||||
|
||||
games = games
|
||||
.Where(game => keywords.All(
|
||||
kw => game.Title.Contains(kw, StringComparison.OrdinalIgnoreCase)
|
||||
))
|
||||
.OrderBy(game => keywords.Min(kw =>
|
||||
game.Title.IndexOf(kw, StringComparison.OrdinalIgnoreCase)
|
||||
))
|
||||
.ThenBy(game => game.Title.Length)
|
||||
.ToList();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (filter.StorageSpaces != null)
|
||||
{
|
||||
var storageSpaces = categoryService.GetStorageSpaces().Where(stor => filter.StorageSpaces.Contains(stor.Id));
|
||||
|
||||
games = games
|
||||
.Where(game => storageSpaces.Any(stor =>
|
||||
(stor.MinSize ?? int.MinValue) <= game.StorageSpace && (stor.MaxSize ?? int.MaxValue) > game.StorageSpace))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,16 @@
|
||||
using AutoMapper;
|
||||
using GameIdeas.Shared.Constants;
|
||||
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;
|
||||
namespace GameIdeas.WebAPI.Services.Games;
|
||||
|
||||
public class GameService(GameIdeasContext context, IMapper mapper) : IGameService
|
||||
public class GameWriteService(GameIdeasContext context, IMapper mapper) : IGameWriteService
|
||||
{
|
||||
public async Task<IEnumerable<GameDto>> GetGames(PaggingDto pagging)
|
||||
{
|
||||
var games = await SelectGames()
|
||||
.OrderBy(g => g.Title)
|
||||
.Skip((pagging.CurrentPage - 1) * pagging.NumberPerPage)
|
||||
.Take(pagging.NumberPerPage)
|
||||
.ToListAsync();
|
||||
|
||||
return mapper.Map<IEnumerable<GameDto>>(games);
|
||||
}
|
||||
|
||||
public async Task<GameDto> GetGameById(int gameId)
|
||||
{
|
||||
var game = await SelectGames()
|
||||
.FirstOrDefaultAsync(g => g.Id == gameId);
|
||||
|
||||
return game == null
|
||||
? throw new NotFoundException($"[{typeof(Game).FullName}] with ID {gameId} has not been found in context")
|
||||
: mapper.Map<GameDto>(game);
|
||||
}
|
||||
|
||||
public async Task<GameDto> CreateGame(GameDto gameDto)
|
||||
public async Task<GameDetailDto> CreateGame(GameDetailDto gameDto)
|
||||
{
|
||||
var gameToCreate = mapper.Map<Game>(gameDto);
|
||||
|
||||
@@ -46,10 +25,10 @@ public class GameService(GameIdeasContext context, IMapper mapper) : IGameServic
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
return mapper.Map<GameDto>(gameToCreate);
|
||||
return mapper.Map<GameDetailDto>(gameToCreate);
|
||||
}
|
||||
|
||||
public async Task<GameDto> UpdateGame(GameDto gameDto)
|
||||
public async Task<GameDetailDto> UpdateGame(GameDetailDto gameDto)
|
||||
{
|
||||
if (await context.Games.CountAsync(g => g.Id == gameDto.Id) == 0)
|
||||
{
|
||||
@@ -67,7 +46,7 @@ public class GameService(GameIdeasContext context, IMapper mapper) : IGameServic
|
||||
context.Games.Update(gameToUpdate);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
return mapper.Map<GameDto>(gameToUpdate);
|
||||
return mapper.Map<GameDetailDto>(gameToUpdate);
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteGame(int gameId)
|
||||
@@ -80,19 +59,6 @@ public class GameService(GameIdeasContext context, IMapper mapper) : IGameServic
|
||||
return await context.SaveChangesAsync() != 0;
|
||||
}
|
||||
|
||||
private IQueryable<Game> SelectGames()
|
||||
{
|
||||
return context.Games
|
||||
.Include(g => g.CreationUser)
|
||||
.Include(g => g.ModificationUser)
|
||||
.Include(g => g.GamePlatforms).ThenInclude(p => p.Platform)
|
||||
.Include(g => g.GameProperties).ThenInclude(p => p.Property)
|
||||
.Include(g => g.GameTags).ThenInclude(p => p.Tag)
|
||||
.Include(g => g.GamePublishers).ThenInclude(p => p.Publisher)
|
||||
.Include(g => g.GameDevelopers).ThenInclude(p => p.Developer)
|
||||
.AsQueryable();
|
||||
}
|
||||
|
||||
private async Task HandlePlatformsCreation(IEnumerable<PlatformDto>? categoriesToCreate, int gameId)
|
||||
{
|
||||
if (categoriesToCreate != null)
|
||||
@@ -0,0 +1,9 @@
|
||||
using GameIdeas.Shared.Dto;
|
||||
|
||||
namespace GameIdeas.WebAPI.Services.Games;
|
||||
|
||||
public interface IGameReadService
|
||||
{
|
||||
Task<IEnumerable<GameDto>> GetGames(GameFilterDto filter);
|
||||
Task<GameDetailDto> GetGameById(int gameId);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using GameIdeas.Shared.Dto;
|
||||
|
||||
namespace GameIdeas.WebAPI.Services.Games;
|
||||
|
||||
public interface IGameWriteService
|
||||
{
|
||||
Task<GameDetailDto> CreateGame(GameDetailDto gameDto);
|
||||
Task<GameDetailDto> UpdateGame(GameDetailDto gameDto);
|
||||
Task<bool> DeleteGame(int gameId);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user