week3/RpsFollowAlong/RepositoryLayer/Repository.cs
/// <summary>
/// deletes selected player from the db and returns true if successful
/// </summary>
/// <param name="playerId"></param>
/// <returns></returns>
deletes selected player from the db and returns true if successful
deletes selected player from the db and returns true if successful
public bool DeletePlayer(Guid playerId)
        {
            Player playerToBeDeleted = GetPlayerById(playerId);
            if (playerToBeDeleted != null)
            {
                _dbContext.players.Remove(playerToBeDeleted);
                _dbContext.SaveChanges();
                return true;
            }
            return false;
        }
public bool DeletePlayer ( Guid playerId ) { Player playerToBeDeleted = GetPlayerById ( playerId ) ; if ( playerToBeDeleted != null ) { _dbContext . players . Remove ( playerToBeDeleted ) ; _dbContext . SaveChanges ( ) ; return true ; } return false ; }
deletes selected player from the db and returns true if successful
deletes selected player from the db and returns true if successful
//if(_dbContext.players.Contains(playerToBeDeleted))
None
playerId
Guid
None