本文整理汇总了C#中MongoRepository.AddList方法的典型用法代码示例。如果您正苦于以下问题:C# MongoRepository.AddList方法的具体用法?C# MongoRepository.AddList怎么用?C# MongoRepository.AddList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoRepository
的用法示例。
在下文中一共展示了MongoRepository.AddList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInstagramFeeds
//.........这里部分代码省略.........
int count = task.Result.Count;
if (count < 1)
{
instagramFeedRepo.Add(objInstagramFeed);
}
else
{
FilterDefinition<BsonDocument> filter = new BsonDocument("FeedId", objInstagramFeed.FeedId);
var update = Builders<BsonDocument>.Update.Set("IsLike", objInstagramFeed.IsLike).Set("CommentCount", objInstagramFeed.CommentCount).Set("LikeCount", objInstagramFeed.LikeCount).Set("Type", objInstagramFeed.Type).Set("VideoUrl", objInstagramFeed.VideoUrl);
instagramFeedRepo.Update<Domain.Socioboard.MongoDomain.InstagramFeed>(update, filter);
}
//if (!objInstagramFeedRepository.checkInstagramFeedExists(userinf2.data[j].id, objInsAccount.UserId))
//{
// objInstagramFeedRepository.addInstagramFeed(objInstagramFeed);
//}
List<Domain.Socioboard.MongoDomain.InstagramComment> lstInstagramComment = new List<Domain.Socioboard.MongoDomain.InstagramComment>();
usercmts = objComment.GetComment(userinf2.data[j].id, objInsAccount.AccessToken);
for (int cmt = 0; cmt < usercmts.data.Count(); cmt++)
{
try
{
Domain.Socioboard.MongoDomain.InstagramComment objInstagramComment = new Domain.Socioboard.MongoDomain.InstagramComment();
try
{
objInstagramComment.Comment = usercmts.data[cmt].text;
}
catch { }
try
{
objInstagramComment.CommentDate = usercmts.data[cmt].created_time.ToString();
}
catch { }
try
{
objInstagramComment.CommentId = usercmts.data[cmt].id;
}
catch { }
//try
//{
// objInstagramComment.EntryDate = DateTime.UtcNow.ToString();
//}
//catch { }
try
{
objInstagramComment.FeedId = userinf2.data[j].id;
}
catch { }
try
{
objInstagramComment.Id = ObjectId.GenerateNewId();
objInstagramComment.strId = ObjectId.GenerateNewId().ToString();
}
catch { }
try
{
objInstagramComment.InstagramId = objInsAccount.InstagramId;
}
catch { }
try
{
// objInstagramComment.UserId = objInsAccount.UserId;
}
catch { }
try
{
objInstagramComment.FromName = usercmts.data[cmt].from.username;
}
catch { }
try
{
objInstagramComment.FromProfilePic = usercmts.data[cmt].from.profile_picture;
}
catch { }
lstInstagramComment.Add(objInstagramComment);
}
catch (Exception ex)
{
logger.Error(ex.StackTrace);
}
}
instagarmCommentRepo.AddList(lstInstagramComment);
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
}
}
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
}
示例2: GetInstagramSelfFeeds
//.........这里部分代码省略.........
{
objInstagramFeed.Feed = item["caption"]["text"].ToString();
}
catch { }
try
{
objInstagramFeed.ImageUrl = item["user"]["profile_picture"].ToString();
}
catch { }
try
{
objInstagramFeed.FromId = item["user"]["id"].ToString();
}
catch { }
try
{
objInstagramFeed.FeedUrl = item["link"].ToString();
}
catch { }
var ret = instagramFeedRepo.Find<Domain.Socioboard.MongoDomain.InstagramFeed>(t => t.FeedId.Equals(objInstagramFeed.FeedId) && t.InstagramId.Equals(objInstagramFeed.InstagramId));
var task = Task.Run(async () =>
{
return await ret;
});
int count = task.Result.Count;
if (count < 1)
{
instagramFeedRepo.Add(objInstagramFeed);
}
else
{
FilterDefinition<BsonDocument> filter = new BsonDocument("FeedId", objInstagramFeed.FeedId);
var update = Builders<BsonDocument>.Update.Set("IsLike", objInstagramFeed.IsLike).Set("CommentCount", objInstagramFeed.CommentCount).Set("LikeCount", objInstagramFeed.LikeCount).Set("Type", objInstagramFeed.Type).Set("VideoUrl", objInstagramFeed.VideoUrl);
instagramFeedRepo.Update<Domain.Socioboard.MongoDomain.InstagramFeed>(update, filter);
}
List<Domain.Socioboard.MongoDomain.InstagramComment> lstInstagramComment = new List<Domain.Socioboard.MongoDomain.InstagramComment>();
usercmts = objComment.GetComment(objInstagramFeed.FeedId, accessToken);
for (int cmt = 0; cmt < usercmts.data.Count(); cmt++)
{
try
{
Domain.Socioboard.MongoDomain.InstagramComment objInstagramComment = new Domain.Socioboard.MongoDomain.InstagramComment();
try
{
objInstagramComment.Comment = usercmts.data[cmt].text;
}
catch { }
try
{
objInstagramComment.CommentDate = usercmts.data[cmt].created_time.ToString();
}
catch { }
try
{
objInstagramComment.CommentId = usercmts.data[cmt].id;
}
catch { }
try
{
objInstagramComment.FeedId = objInstagramFeed.FeedId;
}
catch { }
try
{
objInstagramComment.InstagramId = instagramId;
}
catch { }
try
{
objInstagramComment.FromName = usercmts.data[cmt].from.username;
}
catch { }
try
{
objInstagramComment.FromProfilePic = usercmts.data[cmt].from.profile_picture;
}
catch { }
lstInstagramComment.Add(objInstagramComment);
}
catch (Exception ex)
{
}
}
instagarmCommentRepo.AddList(lstInstagramComment);
}
catch (Exception ex)
{
}
}
}
}
catch (Exception ex)
{
}
}