public PlayerStatsViewModel(string nick) { PlayerNick = nick; SetSeasonStats(); SeasonLineSet(); SeriesLineSet(); SeasonEnabled = _context.SeasonRatingDbSet.Any(x => x.Nick == nick); SeriesEnabled = _context.SeriesRatingDbSet.Any(x => x.Nick == nick); WeekEnabled = _context.WeekRatingDbSet.Any(x => x.Nick == nick); var seasonPlayer = _context.SeasonRatingDbSet.FirstOrDefault(x => x.Nick == nick); if (!string.IsNullOrEmpty(seasonPlayer?.Position)) { var positions = SaluteRepository.GetPosition(seasonPlayer.Position); positions = positions.Where(x => x != 0).ToList(); SeasonMaximum = positions.Count != 0 ? positions.Min() : 0; SeasonMinimum = positions.Count != 0 ? positions.Max() : 0; } var seriesPlayer = _context.SeriesRatingDbSet.FirstOrDefault(x => x.Nick == nick); if (string.IsNullOrEmpty(seriesPlayer?.Position)) { return; } { var positions = SaluteRepository.GetPosition(seriesPlayer.Position); positions = positions.Where(x => x != 0).ToList(); SeriesMaximum = positions.Count != 0 ? positions.Min() : 0; SeriesMinimum = positions.Count != 0 ? positions.Max() : 0; } }
private void SeriesLineSet() { var currPlayer = _context.SeriesRatingDbSet.FirstOrDefault(x => x.Nick == PlayerNick); if (string.IsNullOrEmpty(currPlayer?.Position)) { return; } var positions = SaluteRepository.GetPosition(currPlayer.Position); SeriesLine = LineSet(positions); }