2024-11-26 00:15:31 +04:00
|
|
|
using Contracts.DTO;
|
|
|
|
using Infrastructure.Models;
|
|
|
|
|
|
|
|
namespace Infrastructure.Support.Mappers;
|
|
|
|
|
|
|
|
public static class SpendingGroupMapper
|
|
|
|
{
|
|
|
|
public static SpendingGroupDto ToDto(this SpendingGroup group)
|
|
|
|
=> new()
|
|
|
|
{
|
|
|
|
Id = group.Id,
|
|
|
|
Name = group.Name,
|
2024-11-27 00:26:18 +04:00
|
|
|
UserId = group.UserId,
|
2024-11-27 01:16:08 +04:00
|
|
|
ChangeRecords = group.ChangeRecords?.Select(x => x.ToDto()).ToList() ?? []
|
2024-11-26 00:15:31 +04:00
|
|
|
};
|
|
|
|
public static SpendingGroup ToModel(this SpendingGroupDto group)
|
|
|
|
=> new()
|
|
|
|
{
|
|
|
|
Id = group.Id,
|
|
|
|
Name = group.Name,
|
|
|
|
UserId = group.UserId
|
|
|
|
};
|
|
|
|
}
|