1
0
mirror of synced 2024-12-22 11:15:53 +01:00
GC-local-server-rewrite/Application/Game/Card/Read/ReadSkinQuery.cs

46 lines
1.3 KiB
C#
Raw Normal View History

using Application.Common.Extensions;
using Application.Common.Models;
2023-02-13 17:38:19 +01:00
using Application.Dto;
using Application.Interfaces;
using Domain.Enums;
using Microsoft.EntityFrameworkCore;
namespace Application.Game.Card.Read;
public record ReadSkinQuery(long CardId) : IRequestWrapper<string>;
public class ReadSkinQueryHandler : CardRequestHandlerBase<ReadSkinQuery, string>
{
2023-02-13 17:38:19 +01:00
private const string SKIN_XPATH = "/root/skin/record";
public ReadSkinQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
{
}
public override Task<ServiceResult<string>> Handle(ReadSkinQuery request, CancellationToken cancellationToken)
{
2023-02-13 17:38:19 +01:00
var count = Config.SkinCount;
var list = new List<SkinDto>();
for (int i = 0; i < count; i++)
{
var skin = new SkinDto
{
Id = i,
CardId = request.CardId,
2023-02-16 08:26:13 +01:00
SkinId = i + 1,
2023-02-13 17:38:19 +01:00
Created = "2013-01-01 08:00:00",
Modified = "2013-01-01 08:00:00",
NewFlag = 0,
UseFlag = 1
};
list.Add(skin);
}
var result = list.SerializeCardDataList(SKIN_XPATH);
return Task.FromResult(new ServiceResult<string>(result));
}
}