initial commit
This commit is contained in:
30
Converters/Extensions.cs
Normal file
30
Converters/Extensions.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user