public void InsertProject(Project project, List<Commits> commits) { var database = GetDatabase(); var projects = database.GetCollection<Project>("projects"); projects.Insert(project); var colCommits = database.GetCollection<Commits>("commits"); colCommits.InsertBatch(commits); }
private void InsertCommits(string repositoryUrl, IQueryable<Commit> commits) { var project = new Project() { RepositoryUrl = repositoryUrl, RepositoryAuthor = GetRepositoryAuthor(repositoryUrl), RepositoryName = GetRepositoryName(repositoryUrl) }; var colCommits = commits.Select(x => new Commits { Author = x.Author.Name, Date = x.Author.When.UtcDateTime, SHA = x.Sha, RepositoryUrl = repositoryUrl}).ToList(); new MongoRepository().InsertProject(project, colCommits); }