public List <PlayerDetailsEL> ViewTeamDetails(int userId, int matchId, int roleId) { try { List <PlayerDetailsEL> lstPlayerDetailsEL = new List <PlayerDetailsEL>(); PlayerDetailsEL objPlayerDetailsEL; var tempMD = objUserDB.GetCurrentMatchDetails(userId, matchId); var rolePD = (from t in tempMD where t.ref_PlayerDetails.PlayerRoleId == roleId select t).ToList(); foreach (var pId in rolePD) { objPlayerDetailsEL = new PlayerDetailsEL(); objPlayerDetailsEL.PlayerName = objPlayerBL.GetPlayerNameById((int)pId.PlayerId, matchId); objPlayerDetailsEL.TeamName = objPlayerDB.GetTeamNameById((int)pId.ref_PlayerDetails.ref_TeamDetails.TeamId).ToString(); objPlayerDetailsEL.PlayerPoints = objPlayerBL.GetPlayerPointsById((int)pId.PlayerId, matchId); lstPlayerDetailsEL.Add(objPlayerDetailsEL); } return(lstPlayerDetailsEL); } catch (Exception ex) { throw ex; } }
public List <PlayerDetailsEL> GetPlayerDetailsByRoleId(int matchId, int roleId) { try { PlayerDetailsEL objPDEL; List <PlayerDetailsEL> lstPD = new List <PlayerDetailsEL>(); var playerdetails = objPlayerDB.GetPlayerDetails(matchId); playerdetails = (from res in playerdetails where res.PlayerRoleId == roleId select res).ToList(); foreach (var a in playerdetails) { objPDEL = new PlayerDetailsEL(); objPDEL.PlayerId = a.PlayerId; objPDEL.PlayerName = a.PlayerName; objPDEL.PlayerRoleId = a.PlayerRoleId; objPDEL.PlayerTeamId = a.TeamId; objPDEL.TeamName = objPlayerDB.GetTeamNameById((int)a.TeamId); objPDEL.PlayerPoints = a.Points; lstPD.Add(objPDEL); } lstPD = lstPD.OrderByDescending(t => t.PlayerPoints).ToList(); return(lstPD); } catch (Exception ex) { throw ex; } }