public async Task <int> Create(TEntity entity)
        {
            await _onlibContext.Set <TEntity>().AddAsync(entity);

            var isSaved = await _onlibContext.SaveChangesAsync();

            return(isSaved);
        }
        public async Task <int> Order(BookUserModel bookUser)
        {
            bookUser.BookStatus         = "Booked";
            bookUser.StatusActivateTime = DateTime.Now;

            await _onlibContext.Set <BookUserModel>().AddAsync(bookUser);

            // one book was taken so we should remove one from interface
            var query = from books in _onlibContext.Books
                        where books.Id == bookUser.BookId
                        select books;

            foreach (BookModel book in query)
            {
                book.CopiesNumber -= 1;
            }

            var isSaved = await _onlibContext.SaveChangesAsync();

            return(isSaved);
        }