private async Task <long?> MatchSeason(string seasonName) { try { if (!string.IsNullOrWhiteSpace(seasonName)) { string[] seasonParts = seasonName.Split(' '); if (seasonParts.Length > 1) { int year = Int32.Parse(seasonParts[1]); string season = seasonParts[0]; Data.Model.Season foundSeason = await seasonRepository.GetAsync(x => x.Name.ToLower().Equals(season.ToLower()) && x.Year.Equals(year)); return((foundSeason != null) ? foundSeason.Id : (long?)null); } return(null); } return(null); } catch (Exception) { return(null); } }
private async Task <long?> MatchSeason(int year, Seasons season) { try { Data.Model.Season foundSeason = await seasonRepository.GetAsync(x => x.Name.Equals(season.ToString()) && x.Year.Equals(year)); return((foundSeason != null) ? foundSeason.Id : (long?)null); } catch (Exception) { return(null); } }