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.
41 lines
1.1 KiB
41 lines
1.1 KiB
using Entity_Framework.Entity;
|
|
using Modele.Classe;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Entity_Framework.Factories
|
|
{
|
|
public static class SessionFactorie
|
|
{
|
|
public static Session EntityToModele(this Sessions entity)
|
|
{
|
|
string circuitName = entity.Circuit != null ? entity.Circuit.Name : "Inconnu !";
|
|
string pilotePseudo = entity.Pilote != null ? entity.Pilote.Pseudo : "Inconnu !";
|
|
|
|
return new Session(
|
|
IdArg: entity.Id,
|
|
dateArg: entity.Date,
|
|
nameArg: entity.Name,
|
|
typeArg: entity.Type,
|
|
nameCircuitArg: circuitName,
|
|
namePiloteArg: pilotePseudo
|
|
);
|
|
}
|
|
|
|
|
|
public static Sessions ModeleToEntity(this Session modele)
|
|
{
|
|
Sessions entity = new Sessions();
|
|
|
|
entity.Name = modele.name;
|
|
entity.Type = modele.type;
|
|
entity.Date = modele.date;
|
|
|
|
return entity;
|
|
}
|
|
}
|
|
}
|