week3/RpsFollowAlong/RepositoryLayer/Repository.cs
/// <summary>
/// takes a modified player, adds it to the database, and returns the player from the database
/// </summary>
/// <param name="player"></param>
/// <returns></returns>
takes a modified player, adds it to the database, and returns the player from the database
takes a modified player adds it to the database and returns the player from the database
public Player EditPlayer(Player player)
        {
            Player player1 = GetPlayerById(player.playerId);
            player1.Fname = player.Fname;
            player1.Lname = player.Lname;
            player1.numLosses = player.numLosses;
            player1.numWins = player.numWins;
            player1.ByteArrayImage = player.ByteArrayImage;
            _dbContext.SaveChanges();
            Player player2 = GetPlayerById(player.playerId);
            return player2;
        }
public Player EditPlayer ( Player player ) { Player player1 = GetPlayerById ( player . playerId ) ; player1 . Fname = player . Fname ; player1 . Lname = player . Lname ; player1 . numLosses = player . numLosses ; player1 . numWins = player . numWins ; player1 . ByteArrayImage = player . ByteArrayImage ; _dbContext . SaveChanges ( ) ; Player player2 = GetPlayerById ( player . playerId ) ; return player2 ; }
takes a modified player, adds it to the database, and returns the player from the database
takes a modified player adds it to the database and returns the player from the database
//search db for player //transfer new values //save changes //search player again to verify that player is in db //return edited db
None
player
Player
None