Exemple #1
0
        private async Task <Club> NewClubRequest(string formattedId)
        {
            var requestedClub = await _scraperService.GetClubStatus(formattedId);

            var newClubEntity = new Club()
            {
                Id              = formattedId,
                Exists          = requestedClub.Exists,
                MembershipCount = requestedClub.MembershipCount
            };

            if (requestedClub.Exists)
            {
                newClubEntity.TMIExpiration     = _dateHelpers.GetTmiExpiration();
                newClubEntity.HistoryExpiration = _dateHelpers.GetHistoryExpiration();
                newClubEntity.MetricsHistory    = await _scraperService.GetMetricsHistory(formattedId);
            }

            _context.Clubs.Add(newClubEntity);
            await _context.SaveChangesAsync();

            return(newClubEntity);
        }