コード例 #1
0
        public override Task Official_Driver()
        {
            var filter = Builders <Author> .Filter.Where(a => a.ID == id);

            var update = Builders <Author> .Update.Set(a => a.FirstName, "updated");

            return(AuthorCollection.UpdateOneAsync(filter, update));
        }
コード例 #2
0
 private void SeedDatabase()
 {
     AuthorCollection.InsertOne(new Author
     {
         Id          = Guid.NewGuid(),
         DisplayName = "Author 1",
         UserName    = "******"
     });
 }
コード例 #3
0
 public override Task Official_Driver()
 {
     return(AuthorCollection.InsertOneAsync(new Author
     {
         ID = ObjectId.GenerateNewId().ToString(),
         FirstName = "test",
         LastName = "test",
         Birthday = DateTime.UtcNow,
     }));
 }
コード例 #4
0
        private void SetAuthors()
        {
            var authors = new AuthorCollection();

            foreach (Author account in Books.SelectMany(book => book.Authors))
            {
                authors.Add(account);
            }

            Authors = authors;
        }
コード例 #5
0
        public AuthorRepositoryTests()
        {
            AuthorCollection.InsertOne(new Author
            {
                Id          = Guid.NewGuid(),
                DisplayName = "Bob Ross",
                UserName    = "******"
            });

            var uow = ServiceProvider.GetService <IBlogUnitOfWork>();

            _repository = uow.Authors;
        }
コード例 #6
0
        private void SeedDatabase()
        {
            _authorId = Guid.NewGuid();
            AuthorCollection.InsertOne(new Author
            {
                Id          = _authorId,
                DisplayName = "Author 1",
                UserName    = "******"
            });

            PostCollection.InsertOne(CreatePost(0, _authorId, true, false, "cat1"));
            PostCollection.InsertOne(CreatePost(1, _authorId, true, true, "cat1"));
            PostCollection.InsertOne(CreatePost(2, _authorId, true, true, "cat1,cat2"));
            PostCollection.InsertOne(CreatePost(3, _authorId, true, true, "cat2"));
            PostCollection.InsertOne(CreatePost(4, _authorId, true, true, "cat1,cat2,cat3"));
            PostCollection.InsertOne(CreatePost(5, _authorId, false, true, "cat3"));
        }
コード例 #7
0
        private void SeedDatabase()
        {
            var authorId = Guid.NewGuid();

            AuthorCollection.InsertOne(new Author
            {
                Id          = authorId,
                DisplayName = "Author 1",
                UserName    = "******"
            });

            PostCollection.InsertOne(CreatePost(0, authorId, "cata"));
            PostCollection.InsertOne(CreatePost(1, authorId, "cata"));
            PostCollection.InsertOne(CreatePost(2, authorId, "cata,catb"));
            PostCollection.InsertOne(CreatePost(3, authorId, "catb"));
            PostCollection.InsertOne(CreatePost(4, authorId, "cata,catb,catc"));
            PostCollection.InsertOne(CreatePost(5, authorId, "catc"));
        }
コード例 #8
0
 public ActionResult <AuthorVM> Get(long id)
 {
     return(AuthorCollection.GetAuthorVMs(_accessor.HttpContext.Request.Host.Value)?.FirstOrDefault(x => x.Id == id));
 }
コード例 #9
0
 public ActionResult <IEnumerable <AuthorVM> > Get([FromQuery] QuerySearch query)
 {
     return(AuthorCollection.GetAuthorVMs(_accessor.HttpContext.Request.Host.Value, query)?.ToList());
 }