public List <PlayerScoreEL> GetPlayerPoints(int matchId) { try { PlayerScoreEL objPlayerScoreEL; List <PlayerScoreEL> lstPlayerScore = new List <PlayerScoreEL>(); var tempres = objPlayerDB.GetPlayerScore(); var temp = tempres.Where(t => t.MatchId == matchId).ToList(); // var temp1 = (from score in temp select score); foreach (var s in temp) { objPlayerScoreEL = new PlayerScoreEL(); objPlayerScoreEL.PlayerId = s.PlayerId; objPlayerScoreEL.Runs = (int)s.RunsScored; objPlayerScoreEL.Fours = (int)s.FourCount; objPlayerScoreEL.Sixes = (int)s.SixCount; objPlayerScoreEL.CatchesOrRunout = (int)s.RunOutorCatches; objPlayerScoreEL.WicketsTaken = (int)s.WicketsTaken; objPlayerScoreEL.MaidenOvers = (int)s.MaidenOvers; objPlayerScoreEL.TotalPlayerPoints = CalculateRun(objPlayerScoreEL.Runs, objPlayerScoreEL.Fours, objPlayerScoreEL.Sixes, objPlayerScoreEL.CatchesOrRunout, objPlayerScoreEL.WicketsTaken, objPlayerScoreEL.MaidenOvers); lstPlayerScore.Add(objPlayerScoreEL); } return(lstPlayerScore); } catch (Exception ex) { throw ex; } }