week2/RpsGame_Refactored/RpsGameRepositoryLayer.cs
/// <summary>
/// Creates a player after verifying that the player doesn't already exist.
/// </summary>
/// <returns>Player player</returns>
Creates a player after verifying that the player doesn't already exist.
Creates a player after verifying that the player doesn ' t already exist .
public Player CreatePlayer(string fname = "null", string lname = "null"){
            Player p1 = players.Where(x => x.Fname == fname && x.Lname == lname).FirstOrDefault();
            if(p1==null)  {
            p1 = new Player()
            {
                Fname = fname,
                Lname = lname
            };
            players.Add(p1);
            }
            return p1;
        }
public Player CreatePlayer ( string fname = " " , string lname = " " ) { Player p1 = players . Where ( x => x . Fname == fname && x . Lname == lname ) . FirstOrDefault ( ) ; if ( p1 == null ) { p1 = new Player ( ) { Fname = fname , Lname = lname } ; players . Add ( p1 ) ; } return p1 ; }
Creates a player after verifying that the player doesn't already exist.
Creates a player after verifying that the player doesn ' t already exist .
None
fname
string
lname
string