コード例 #1
0
 public Player(string name, string lastName, string secondLastName,
               string identification, string homeAddress, string phone, StrongFoot strongFoot, string email)
     : base(name, lastName, secondLastName, identification, homeAddress, phone, email)
 {
     PlayersPositions = new List <PlayerPosition>();
     StrongFoot       = strongFoot;
 }
コード例 #2
0
    public static Player AddPlayerAndReturnIt(string identification, StrongFoot strongFoot,
                                              string name, string lastName, string secondLastName, string homeAddress, string phone, string email)
    {
        var playerFound = context.Players.FirstOrDefault(p => p.Identification == identification &&
                                                         p.Name == name && p.LastName == lastName && p.SecondLastName == secondLastName);

        if (playerFound == null)
        {
            var player = new Player(name, lastName, secondLastName, identification, homeAddress, phone, strongFoot, email);
            context.Players.Add(player);
            return(player);
        }
        return(playerFound);
    }