public async Task CrawlProfileImagesAsync(Profile profile) { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } CrawlHelper.CrawlProfile(profile.UserName); profile.ProfileStatus = ProfileStatus.CRAWLED; await _profiles.ReplaceOneAsync(p => p.Id == profile.Id, profile); }
public async Task CrawlProfileImagesAsync(string id) { var profile = await _profiles.Find <Profile>(p => p.Id == id).FirstOrDefaultAsync(); if (profile == null) { throw new Exception($"Cannot find profile with Id: {id}"); } CrawlHelper.CrawlProfile(profile.UserName); profile.ProfileStatus = ProfileStatus.CRAWLED; await _profiles.ReplaceOneAsync(p => p.Id == id, profile); }