classlib/ExpenseTracker.Application/Accounts/TransactionCsvMap.cs
2024-08-07 21:12:02 +03:00

21 lines
838 B
C#

using System.Globalization;
using CsvHelper.Configuration;
using ExpenseTracker.Application.Common.Extensions;
using ExpenseTracker.Application.Transactions;
namespace ExpenseTracker.Application.Accounts;
public class TransactionCsvMap : ClassMap<TransactionDto>
{
public TransactionCsvMap()
{
AutoMap(CultureInfo.InvariantCulture);
Map(e => e.Id).Ignore();
Map(e => e.Amount).Name(nameof(TransactionDto.Amount).ToString().FirstCharacterToLower());
Map(e => e.Category).Name(nameof(TransactionDto.Category).ToString().FirstCharacterToLower());
Map(e => e.Time).Name(nameof(TransactionDto.Time).ToString().FirstCharacterToLower());
Map(e => e.Description).Name(nameof(TransactionDto.Description).ToString().FirstCharacterToLower());
Map(e => e.AccountId).Ignore();
}
}