Exemple #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));
        }
 private void SeedDatabase()
 {
     AuthorCollection.InsertOne(new Author
     {
         Id          = Guid.NewGuid(),
         DisplayName = "Author 1",
         UserName    = "******"
     });
 }
Exemple #3
0
 public override Task Official_Driver()
 {
     return(AuthorCollection.InsertOneAsync(new Author
     {
         ID = ObjectId.GenerateNewId().ToString(),
         FirstName = "test",
         LastName = "test",
         Birthday = DateTime.UtcNow,
     }));
 }
        private void SetAuthors()
        {
            var authors = new AuthorCollection();

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

            Authors = authors;
        }
        public AuthorRepositoryTests()
        {
            AuthorCollection.InsertOne(new Author
            {
                Id          = Guid.NewGuid(),
                DisplayName = "Bob Ross",
                UserName    = "******"
            });

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

            _repository = uow.Authors;
        }
Exemple #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"));
        }
Exemple #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"));
        }
 public ActionResult <AuthorVM> Get(long id)
 {
     return(AuthorCollection.GetAuthorVMs(_accessor.HttpContext.Request.Host.Value)?.FirstOrDefault(x => x.Id == id));
 }
 public ActionResult <IEnumerable <AuthorVM> > Get([FromQuery] QuerySearch query)
 {
     return(AuthorCollection.GetAuthorVMs(_accessor.HttpContext.Request.Host.Value, query)?.ToList());
 }