Files
weddingapi/Converters/Extensions.cs
2022-01-23 19:20:13 +01:00

31 lines
695 B
C#

using System.Linq;
using weddingapi.Dtos;
using weddingapi.Models;
namespace weddingapi.Converters
{
public static class Converters
{
public static FamilyDto AsDto(this Family family)
{
return new FamilyDto()
{
Id = family.Id,
CreatedDate = family.CreatedDate,
Members = family.Members.Select(person => person.AsDto()).ToList(),
Name = family.Name,
};
}
public static PersonDto AsDto(this Person person)
{
return new PersonDto()
{
IsChild = person.IsChild,
Name = person.Name,
};
}
}
}