Exemple #1
0
        public async Task <MatchDetails> GetMatchDetails(IKitIdentity match)
        {
            RequireLogin();
            var detailsResult = await _connector.GetMatchDetailsAsync(match.ResultId1, match.ResultId2);

            return(detailsResult.Result);
        }
        public async Task <IEnumerable <Match> > ListInCommonWith(IKitIdentity match)
        {
            if (TryGetStoredResult("ListInCommonWith", out IEnumerable <Match> cached, match.ResultId2))
            {
                return(cached);
            }

            var result = await _service.ListInCommonWith(match);

            StoreResult("ListInCommonWith", result, match.ResultId2);
            return(result);
        }
        public async Task <MatchDetails> GetMatchDetails(IKitIdentity match)
        {
            if (TryGetStoredResult("GetMatchDetails", out MatchDetails cached, match.ResultId2))
            {
                return(cached);
            }

            var result = await _service.GetMatchDetails(match);

            StoreResult("GetMatchDetails", result, match.ResultId2);

            return(result);
        }
Exemple #4
0
        public async Task <IEnumerable <Match> > ListInCommonWith(IKitIdentity match)
        {
            RequireLogin();

            var  result = new List <Match>();
            bool done   = false;

            for (int page = 1; !done; page++)
            {
                var matchResult = await _connector.ListInCommonWithAsync(match.ResultId2, page);

                result.AddRange(matchResult.Data);
                done = matchResult.Count != FtdnaConnector.DefaultPageSize;
            }
            return(result);
        }
Exemple #5
0
        internal Kit AddInCommonWith(IKitIdentity match)
        {
            Kit existingMatch = Profile.Matches.SingleOrDefault(m =>
                                                                m.ResultId2 == match.ResultId2);

            if (existingMatch == null)
            {
                throw new ICWNotFoundAsAMatchException("ICW must be a profile match");
            }

            Kit icwAlreadyAdded = _icw.SingleOrDefault(i => i.ResultId2 == match.ResultId2);

            if (icwAlreadyAdded != null)
            {
                return(icwAlreadyAdded);
            }

            _icw.Add(existingMatch);
            existingMatch._icw.Add(this);
            return(existingMatch);
        }