23 lines
625 B
C#
23 lines
625 B
C#
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,
|
|
UserId = group.UserId,
|
|
ChangeRecords = group.ChangeRecords?.Select(x => x.ToDto()).ToList() ?? []
|
|
};
|
|
public static SpendingGroup ToModel(this SpendingGroupDto group)
|
|
=> new()
|
|
{
|
|
Id = group.Id,
|
|
Name = group.Name,
|
|
UserId = group.UserId
|
|
};
|
|
} |