Example #1
0
        public BookDomain Update(BookDomain book)
        {
            var bookEntity = Map(book);

            dbContext.Books.ReplaceOne(Builders <Book> .Filter.Eq(s => s.Id, book.Id), bookEntity);
            return(Map(bookEntity));
        }
Example #2
0
        public BookDomain Add(BookDomain book)
        {
            var bookEntity = Map(book);

            dbContext.Books.InsertOne(bookEntity);
            return(Map(bookEntity));
        }
Example #3
0
 private Book Map(BookDomain book)
 {
     return(new Book()
     {
         Id = book.Id,
         Title = book.Title,
         Author = book.Author,
         Path = book.Path,
         Status = book.Status.ToString()
     });
 }
Example #4
0
 public void Update(Guid id, BookDomain bookIn) =>
 dbContext.Books.ReplaceOne(book => book.Id == id, Map(bookIn));