예제 #1
0
        public async Task <int> RefreshAllCommunityInfo()
        {
            SeashellContext context = new SeashellContext();

            List <AdministrativeDistrict> districts = context.AdministrativeDistrict.ToList();

            List <Community> communities = new List <Community>();

            foreach (AdministrativeDistrict district in districts)
            {
                List <Community> communitiesByDistrict = await ReadAllCommunities(district.CommunityMainPageURL);

                communities = communities.Concat(communitiesByDistrict).ToList();
            }

            communities = await ReadCommunityDetailInfo(communities);

            CommunityRepository repo = new CommunityRepository(context);

            repo.AddOrUpdate(communities);

            repo.Save();

            return(communities.Count());
        }
예제 #2
0
        public async Task <int> GetHistoryInfoForAllCommunities()
        {
            SeashellContext context = new SeashellContext();

            List <Community> communities = context.Communities.ToList();

            communities = await ReadCommunityDetailInfo(communities);

            CommunityRepository repo = new CommunityRepository(context);

            repo.AddOrUpdate(communities);

            repo.Save();

            return(communities.Count());
        }