28 lines
867 B
C#
28 lines
867 B
C#
using Contracts.DTO;
|
|
using Infrastructure.Models;
|
|
|
|
namespace Infrastructure.Support.Mappers;
|
|
|
|
public static class ChangeRecordMapper
|
|
{
|
|
public static ChangeRecordDto ToDto(this ChangeRecord changeRecord)
|
|
=> new()
|
|
{
|
|
Id = changeRecord.Id,
|
|
Sum = changeRecord.Sum,
|
|
ChangedAt = changeRecord.ChangedAt,
|
|
SpendingGroupId = changeRecord.SpendingGroupId,
|
|
UserId = changeRecord.UserId,
|
|
SpendingGroupName = changeRecord.SpendingGroup?.Name
|
|
};
|
|
|
|
public static ChangeRecord ToModel(this ChangeRecordDto changeRecord)
|
|
=> new()
|
|
{
|
|
Id = changeRecord.Id,
|
|
Sum = changeRecord.Sum,
|
|
ChangedAt = changeRecord.ChangedAt,
|
|
SpendingGroupId = changeRecord.SpendingGroupId,
|
|
UserId = changeRecord.UserId
|
|
};
|
|
} |