You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
737 B
28 lines
737 B
using Model.Players;
|
|
|
|
namespace Data.EF.Players
|
|
{
|
|
public static class PlayerExtensions
|
|
{
|
|
public static Player ToModel(this PlayerEntity entity)
|
|
{
|
|
return new Player(name: entity.Name);
|
|
}
|
|
|
|
public static IEnumerable<Player> ToModels(this IEnumerable<PlayerEntity> entities)
|
|
{
|
|
return entities.Select(entity => entity.ToModel());
|
|
}
|
|
|
|
public static PlayerEntity ToEntity(this Player model)
|
|
{
|
|
return new PlayerEntity() { Name = model.Name };
|
|
}
|
|
|
|
public static IEnumerable<PlayerEntity> ToEntities(this IEnumerable<Player> models)
|
|
{
|
|
return models.Select(model => model.ToEntity());
|
|
}
|
|
}
|
|
}
|