Пример #1
0
        private void UpdateList()
        {
            for (int i = 0; i < _listBooks.Count(); i++)
            {
                BookLibrary book = _listBooks[i];

                string bookAuthor        = book.Author;
                string bookPublisher     = book.Publisher;
                string bookDatePublished = book.DatePublished.ToString();
                string bookGenre         = book.Genre;
                string bookPages         = book.NumPages.ToString();
                string bookBorrowed      = book.DateBorrowed.ToString();
                string bookDue           = book.DueDate.ToString();
                string bookFrom          = book.Library;

                ListViewItem lvt = new ListViewItem(book.Title);
                lvt.SubItems.Add(bookAuthor);
                lvt.SubItems.Add(bookPublisher);
                lvt.SubItems.Add(bookDatePublished);
                lvt.SubItems.Add(bookPages);
                lvt.SubItems.Add(bookGenre);
                lvt.SubItems.Add(bookBorrowed);
                lvt.SubItems.Add(bookDue);
                lvt.SubItems.Add(bookFrom);

                listLibrary.Items.Add(lvt);
            }
        }
Пример #2
0
        public void AddNewLibraryBook(IAddNewLibraryBookView inForm, ILibraryRepository libraryRepository)
        {
            if (inForm.ShowViewModal() == true)
            {
                try
                {
                    string   title        = inForm.Title;
                    string   author       = inForm.Author;
                    string   publisher    = inForm.Publisher;
                    DateTime datePub      = inForm.DatePublished;
                    int      numPages     = inForm.NumberOfPages;
                    string   genre        = inForm.Genre;
                    DateTime dateBorrowed = inForm.DateBorrowed;
                    DateTime dueDate      = inForm.DueDate;
                    string   library      = inForm.Library;

                    BookLibrary newLibrary = BookFactory.CreateBookLibrary(title, author, publisher, datePub, numPages, genre, dateBorrowed, dueDate, library);

                    libraryRepository.AddBookLibrary(newLibrary);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("EXCEPTION: " + ex.Message);
                    throw;
                }
            }
        }
Пример #3
0
 public void add(Models.Category category)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         dc.addCategory(category.Id, category.name, category.description);
     }
 }
Пример #4
0
 public void add(Models.Author author)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         dc.addAuthor(author.Id, author.name);
     }
 }
Пример #5
0
 public void add(Models.Book book)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         dc.addBook(book.id, book.name, book.authorId, book.categoryId);
     }
 }
Пример #6
0
        static void Main(string[] args)
        {
            MenuForm mn = new MenuForm();

            mn.addMenuItem("1. Add a book");
            mn.addMenuItem("2. Find a book");
            mn.addMenuItem("3. Show book list");
            mn.addMenuItem("4. Remove a book");
            mn.addMenuItem("5. Exit");
            int         choice      = 0;
            BookLibrary bookLibrary = new BookLibrary();

            do
            {
                Console.WriteLine("********** Book Management **********");
                choice = mn.GetChoice(0, 5);
                switch (choice)
                {
                case 1:
                    string id        = Util.getString("Input ID: ", "ID is invalid");
                    string name      = Util.getString("Input Book Name: ", "Book name is invalid");
                    string author    = Util.getString("Input Author: ", "Author is invalid");
                    string publisher = Util.getString("Input Publisher: ", "Publisher is invalid");
                    Book   book      = new Book(id, name, author, publisher);
                    bookLibrary.AddBook(book);
                    Console.WriteLine("Added new book!");
                    break;

                case 2:
                    string searchedID = Util.getString("Input ID to find book: ", "ID is invalid");
                    Book   foundBook  = bookLibrary.FindBook(searchedID);
                    if (foundBook != null)
                    {
                        Console.WriteLine(foundBook.ToString());
                    }
                    else
                    {
                        Console.WriteLine("Book not found!");
                    }
                    break;

                case 3:
                    bookLibrary.ShowBookList();
                    break;

                case 4:
                    string removedID = Util.getString("Input ID to remove book: ", "ID is invalid");
                    bool   removed   = bookLibrary.RemoveBook(removedID);
                    if (removed)
                    {
                        Console.WriteLine("Removed " + removedID + " book successfully");
                    }
                    else
                    {
                        Console.WriteLine("Removed " + removedID + " book failed");
                    }
                    break;
                }
            } while (choice > 0 && choice < 5);
        }
Пример #7
0
        public BookLibrary Create(BookLibrary BookLibrary)
        {
            var result = _context.Add <BookLibrary>(BookLibrary);

            _context.SaveChanges();
            return(result.Entity);
        }
Пример #8
0
 public void delete(Guid id)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         dc.removeAuthor(id);
     }
 }
Пример #9
0
        public BookLibrary Delete(BookLibrary BookLibrary)
        {
            var result = _context.Remove(BookLibrary);

            _context.SaveChanges();
            return(result.Entity);
        }
Пример #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Cwiczenie 9\n");

            BookLibrary lib = new BookLibrary();

            lib.AddBook(new Book("Tytul_1", "Autor1", 12.50, "123", new DateTime(2019, 11, 2)));
            lib.AddBook(new Book("Tytul_2", "Autor2", 22.50, "124", new DateTime(2018, 9, 30)));
            lib.AddBook(new Book("Tytul_3", "Autor3", 13.99, "125", new DateTime(2017, 6, 23)));
            lib.AddBook(new Book("Tytul_4", "Autor1", 6.66, "126", new DateTime(2016, 7, 14)));
            lib.AddBook(new Book("Tytul_5", "Autor2", 77.99, "127", new DateTime(2015, 5, 3)));
            lib.AddBook(new Book("Tytul_6", "Autor3", 12.80, "128", new DateTime(2014, 12, 17)));
            lib.AddBook(new Book("Tytul_7", "Autor1", 17.50, "129", new DateTime(2013, 5, 22)));
            lib.AddBook(new Book("Tytul_8", "Autor2", 2.50, "130", new DateTime(2012, 3, 5)));
            lib.AddBook(new Book("Tytul_9", "Autor3", 13.13, "131", new DateTime(2011, 1, 24)));
            lib.print();

            Console.WriteLine("------------------------------");
            List <Book> BookList = new List <Book>();

            BookList = lib.FindByTitle("Tytul_3");

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            BookList = lib.FindByAuthor("Autor2");

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            BookList = lib.FindByPrice(6.66);

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            BookList = lib.FindByISBN("130");

            for (int i = 0; i < BookList.Count; i++)
            {
                Console.WriteLine();
                BookList[i].print();
            }

            Console.WriteLine("\n{0}", lib.IsExists(new Book("Tytul_9", "Autor3", 13.13, "131", new DateTime(2011, 1, 24))));

            Console.WriteLine("\n-----------------------------\n");

            lib.RemoveBook("125");
            lib.print();
        }
Пример #11
0
 public void update(Models.Author author)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         var original = from a in dc.GetTable<Models.Author>() where a.Id == author.Id select a;
         dc.updateAuthor(author.Id, author.name);
     }
 }
Пример #12
0
 public void update(Models.Book book)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         var original = from b in dc.GetTable<Models.Book>() where b.id == book.id select b;
         dc.updateBook(book.id, book.name, book.authorId, book.categoryId);
     }
 }
Пример #13
0
 public void update(Models.Category category)
 {
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         var original = from c in dc.GetTable<Models.Category>() where c.Id == category.Id select c;
         dc.updateCategory(category.Id, category.name, category.description);
     }
 }
Пример #14
0
        public void AddBookLibrary(BookLibrary bookLibrary)
        {
            bookLibrary._bookId = ++_lastId;

            _listBooks.Add(bookLibrary);

            NotifyObservers();
        }
 static BookLibraryStaticMemoryRepository()
 {
     _memoryBookLibrary = new BookLibrary();
     foreach (var title in _bookTitles)
     {
         _memoryBookLibrary.Add(title);
     }
 }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SigmaBookAPI.Controllers.BooksController"/> class.
        /// Maps books.xml to POCO
        /// </summary>
        public BooksController()
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(BookLibrary));

            using (TextReader textReader = new StreamReader(@"./books.xml"))
            {
                BookLibrary = (BookLibrary)deserializer.Deserialize(textReader);
            }
        }
        static void Main(string[] args)
        {
            BookLibrary bookLibrary = new BookLibrary();

            bookLibrary.AddBook(new Book("C# via CLR", "Jeffrey Richter", 2013));
            bookLibrary.AddBook(new Book("C# via CLR", "Jeffrey Richter", 2010));
            bookLibrary.AddBook(new Book("Test Book", "Фамилия автора", 2007));
            bookLibrary.AddBook(new Book("C# 4.0", "Bart De Smet", 2010));
            bookLibrary.AddBook(new Book("Book name", "Автор 2", 2007));

            Console.WriteLine($"Books count: {bookLibrary.Books.Count}");
            bookLibrary.RemoveBook(new Book("Test Book", "Фамилия автора", 2007));
            Console.WriteLine($"Books count: {bookLibrary.Books.Count}");

            bookLibrary.Save(new BinaryManager("books.txt"));
            bookLibrary.RemoveBook(new Book("C# via CLR", "Jeffrey Richter", 2010));
            Console.WriteLine($"Books count: {bookLibrary.Books.Count}\n");
            bookLibrary.Load(new BinaryManager("books.txt"));
            bookLibrary.AddBook(new Book("Паттерны проектирования на платформе .NET", "Тепляков Сергей", 2015));

            foreach (var book in bookLibrary.Books)
            {
                Console.WriteLine($"Название: {book.Name}\nАвтор: {book.Author}\nГод: {book.Year}\n------------");
            }

            Console.WriteLine($"\nFound books count: {bookLibrary.FindBooks((x) => { return String.Compare(x.Author, "Jeffrey Richter") == 0; }).Count}\n");

            bookLibrary.SortBooks();

            foreach (var book in bookLibrary.Books)
            {
                Console.WriteLine($"Название: {book.Name}\nАвтор: {book.Author}\nГод: {book.Year}\n------------");
            }


            Console.WriteLine();
            bookLibrary.SortBooks(new Logic.SortConditions.SortByAuthor());
            foreach (var book in bookLibrary.Books)
            {
                Console.WriteLine($"Название: {book.Name}\nАвтор: {book.Author}\nГод: {book.Year}\n------------");
            }

            Console.WriteLine($"Books count: {bookLibrary.Books.Count}");
            bookLibrary.Save(new BinarySerializationManager("books.bin"));
            bookLibrary.RemoveBook(new Book("C# 4.0", "Bart De Smet", 2010));
            bookLibrary.Load(new BinarySerializationManager("books.bin"));
            Console.WriteLine($"Books count: {bookLibrary.Books.Count}");

            Console.WriteLine($"Books count: {bookLibrary.Books.Count}");
            bookLibrary.Save(new XmlManager("books.xml"));
            bookLibrary.RemoveBook(new Book("C# 4.0", "Bart De Smet", 2010));
            bookLibrary.Load(new XmlManager("books.xml"));
            Console.WriteLine($"Books count: {bookLibrary.Books.Count}");

            Console.ReadKey();
        }
Пример #18
0
 public Models.Book get(Guid id)
 {
     Models.Book book = null;
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         IEnumerable<Models.Book> allBooks = from b in dc.GetTable<Models.Book>() where b.id == id select b;
         book = allBooks.FirstOrDefault();
     }
     return book;
 }
Пример #19
0
 public Models.Author get(Guid id)
 {
     Models.Author author = null;
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         IEnumerable<Models.Author> allAuthors = from a in dc.GetTable<Models.Author>() where a.Id == id select a;
         author = allAuthors.FirstOrDefault();
     }
     return author;
 }
Пример #20
0
        public BookLibrary Post(BookLibraryDTO value)
        {
            BookLibrary model = new BookLibrary()
            {
                BookId    = value.BookId,
                LibraryId = value.LibraryId
            };

            return(IBookLibraryRepository.Create(model));
        }
Пример #21
0
        public UpdateBook(BookLibrary book)
        {
            InitializeComponent();

            bookLibrary             = book;
            BookTextBox.Text        = book.Book;
            AuthorTextBox.Text      = book.Author;
            PagesTextBox.Text       = book.Pages.ToString();
            RealeseDateTextBox.Text = book.RealeseDate.ToString();
        }
Пример #22
0
 public Models.Category get(Guid id)
 {
     Models.Category category = null;
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         IEnumerable<Models.Category> allCategories = from c in dc.GetTable<Models.Category>() where c.Id == id select c;
         category = allCategories.FirstOrDefault();
     }
     return category;
 }
Пример #23
0
        public BookLibrary Create(BookLibrary newBookLibrary)
        {
            Log("Create");
            newBookLibrary.Id = 0;

            UnitOfWork.GetRepository <BookLibrary>().Create(newBookLibrary);
            UnitOfWork.SaveChanges();

            refreshBookLibraries();

            return(newBookLibrary);
        }
Пример #24
0
        public void Get_GivenBookIdOutOfRange_ThrowError()
        {
            // Arrange
            var bookLibrary = new BookLibrary();

            bookLibrary.Add("A Tale of Two Cities");
            bookLibrary.Add("Fellowship of the Ring");
            bookLibrary.Add("Pride and Prejudice and Zombies");

            // Act
            Assert.Throws <KeyNotFoundException>(() => bookLibrary.Get(5));
        }
Пример #25
0
 public List<Models.Category> get()
 {
     List<Models.Category> categories = new List<Models.Category>();
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         IEnumerable<Models.Category> allCategories = from c in dc.GetTable<Models.Category>() select c;
         foreach (var category in allCategories)
         {
             categories.Add(category);
         }
     }
     return categories;
 }
        public void Save(BookLibrary library)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                new DataContractJsonSerializer(typeof(BookLibrary)).WriteObject(ms, library);
                ms.Position = 0;

                using (var reader = new StreamReader(ms))
                {
                    File.WriteAllText(filePath, reader.ReadToEnd());
                }
            }
        }
Пример #27
0
 public List<Models.Author> get()
 {
     List<Models.Author> authors = new List<Models.Author>();
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         IEnumerable<Models.Author> allAuthors = from a in dc.GetTable<Models.Author>() select a;
         foreach (var author in allAuthors)
         {
             authors.Add(author);
         }
     }
     return authors;
 }
Пример #28
0
 public List<Models.Book> get()
 {
     List < Models.Book > books = new List<Models.Book>();
     using (BookLibrary dc = new BookLibrary(connectionString, mapping))
     {
         IEnumerable<Models.Book> allBooks = from b in dc.GetTable<Models.Book>() select b;
         foreach (var book in allBooks)
         {
             books.Add(book);
         }
     }
     return books;
 }
Пример #29
0
        public BookLibrary Put(int id, BookLibraryDTO value)
        {
            BookLibrary model = IBookLibraryRepository.Get(id);

            if (value.BookId != 0)
            {
                model.BookId = value.BookId;
            }
            if (value.LibraryId != 0)
            {
                model.LibraryId = value.LibraryId;
            }
            return(IBookLibraryRepository.Update(model));
        }
Пример #30
0
        public void Add_GivenBookTitle_AddBookToLibrary()
        {
            // Arrange
            var expectedBookTitle = "A Tale of Two Cities";
            var bookLibrary       = new BookLibrary();

            // Act
            bookLibrary.Add(expectedBookTitle);

            // Assert
            List <string> actual = bookLibrary.GetAll();

            actual.Should().Contain(expectedBookTitle);
        }
Пример #31
0
        public void Delete_GivenBookId_RemovesBookFromLibrary()
        {
            // Arrange
            var bookLibrary = new BookLibrary();

            bookLibrary.Add("A Tale of Two Cities");
            bookLibrary.Add("Fellowship of the Ring");
            bookLibrary.Add("Pride and Prejudice and Zombies");

            // Act
            bookLibrary.Delete(1);

            // Assert
            Assert.Throws <KeyNotFoundException>(() => bookLibrary.Get(1));
        }
Пример #32
0
        public void AddRating_GivenOutOfRangeRating_ThrowsError(int inputRating)
        {
            // Arrange
            var bookLibrary = new BookLibrary();

            bookLibrary.Add("A Tale of Two Cities");
            bookLibrary.Add("Fellowship of the Ring");
            bookLibrary.Add("Pride and Prejudice and Zombies");

            // Act
            var exception = Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                                        bookLibrary.AddRating(1, inputRating));

            exception.Message.Should().Contain("Rating needs to be a number from 1 and 10");
        }
Пример #33
0
        public void Load()
        {
            Log.Debug("Loading data from file");

            if (bookLibraryRepository.FileExists())
            {
                Log.Debug("Loading from file");
                bookLibrary = bookLibraryRepository.Load();
            }
            else
            {
                bookLibrary = new BookLibrary();
            }

            Log.Debug("Loading data from file complete");
        }
Пример #34
0
        public void Get_GivenBookId_ReturnSpecifiedBook()
        {
            // Arrange
            var bookLibrary       = new BookLibrary();
            var expectedBookTitle = "Fellowship of the Ring";

            bookLibrary.Add("A Tale of Two Cities");
            bookLibrary.Add(expectedBookTitle);
            bookLibrary.Add("Pride and Prejudice and Zombies");

            // Act
            var actual = bookLibrary.Get(1);

            // Assert
            actual.Title.Should().Be(expectedBookTitle);
        }
Пример #35
0
        public ActionResult Add([Bind("BookId", "LibraryId")] BookLibraryDto BookLibrary)
        {
            if (BookLibrary.BookId == 0)
            {
                return(HttpBadRequest("Could not add book to library. Book id:" + BookLibrary.BookId + " is not a valid book id."));
            }

            if (BookLibrary.LibraryId == 0)
            {
                return(HttpBadRequest("Could not add book to library. Library id:" + BookLibrary.LibraryId + " is not a valid library id."));
            }

            var existingBook = _bookService.Get(BookLibrary.BookId);

            if (existingBook == null)
            {
                return(HttpBadRequest("Could not add book to library. Book id:" + BookLibrary.BookId + " does not exist."));
            }

            var existingLibrary = _libraryService.Get(BookLibrary.LibraryId);

            if (existingLibrary == null)
            {
                return(HttpBadRequest("Could not add book to library. Library id:" + BookLibrary.LibraryId + " does not exist."));
            }

            BookLibrary addedBookLibrary = null;

            if (ModelState.IsValid)
            {
                var newBookLibrary = new BookLibrary
                {
                    Book    = existingBook,
                    Library = existingLibrary
                };

                addedBookLibrary = _bookService.AddToLibrary(newBookLibrary);
            }

            if (addedBookLibrary == null)
            {
                return(HttpBadRequest("Could not add book to library."));
            }

            return(new JsonResult(addedBookLibrary));
        }
Пример #36
0
        public void Edit_GivenBookIdAndNewTitle_ChangesBookId()
        {
            // Arrange
            var bookLibrary       = new BookLibrary();
            var expectedBookTitle = "War and Peace";

            bookLibrary.Add("A Tale of Two Cities");
            bookLibrary.Add("Fellowship of the Ring");
            bookLibrary.Add("Pride and Prejudice and Zombies");

            // Act
            bookLibrary.Edit(1, expectedBookTitle);

            // Assert
            var actual = bookLibrary.Get(1);

            actual.Title.Should().Be(expectedBookTitle);
        }
Пример #37
0
        public void AddRating_GivenValidBookIdAndRating_AddsRatingToBook()
        {
            // Arrange
            var expectedRating = 5;
            var bookLibrary    = new BookLibrary();

            bookLibrary.Add("A Tale of Two Cities");
            bookLibrary.Add("Fellowship of the Ring");
            bookLibrary.Add("Pride and Prejudice and Zombies");

            // Act
            bookLibrary.AddRating(1, expectedRating);

            // Assert
            var actual = bookLibrary.Get(1);

            actual.Rating.Should().Be(expectedRating);
        }
Пример #38
0
 private void CreateButton_Click(object sender, EventArgs e)
 {
     if (CheckingFields())
     {
         int pages;
         int.TryParse(PagesBox.Text, out pages);
         int realeseDate;
         int.TryParse(RealeseDatetextBox.Text, out realeseDate);
         var book = new BookLibrary
         {
             Book        = BooktextBox.Text,
             Author      = AuthortextBox.Text,
             Pages       = pages,
             RealeseDate = realeseDate
         };
         dataAccess.CreateBook(book);
         Close();
     }
 }
        public async Task AddBookLibrary(BookLibraryDto input)
        {
            List <string> errorList = new List <string>();

            var value = new BookLibrary
            {
                BookId    = input.BookId,
                LibraryId = input.LibraryId,
                Stock     = input.Stock
            };

            BookLibraryValidator validator        = new BookLibraryValidator();
            ValidationResult     validationResult = validator.Validate(value);

            var datas = _bookLibraryRepository.GetAll();

            if (!validationResult.IsValid)
            {
                foreach (var failure in validationResult.Errors)
                {
                    errorList.Add(string.Format("{0}", failure.ErrorMessage));
                }
                string errorString = string.Join(" ", errorList.ToArray());
                throw new UserFriendlyException(errorString);
            }

            var data = datas.Where(d => d.BookId == input.BookId && d.LibraryId == input.LibraryId).ToList();

            if (data.Count != 0)
            {
                foreach (var ed in data)
                {
                    ed.Stock = ed.Stock + input.Stock;

                    await _bookLibraryRepository.UpdateAsync(ed);
                }
            }
            else
            {
                await _bookLibraryRepository.InsertAsync(value);
            }
        }
Пример #40
0
        static void Main(string[] args)
        {
            BookLibrary bookLibrary = new BookLibrary("南昌大学图书馆");

            bookLibrary.InitLibrary();

            var master = bookLibrary.QueryBookMaster("机械设计").FirstOrDefault();

            if (master == null)
            {
                return;
            }

            bookLibrary.CreateBookItems(master, 100m, 10);
            //bookLibrary.CreateBookItems()
            bookLibrary.BuyBook();

            //登录
            //加载自己的借书记录,通过borrowerId
            //var borrowLogList = bookLibrary.GetBorrowLogByUserId("111");
        }
Пример #41
0
        public void Post(BookDTO value)
        {
            Book model = new Book()
            {
                Name            = value.Name,
                Popularity      = value.Popularity,
                PublicationYear = value.PublicationYear
            };

            IBookRepository.Create(model);
            for (int i = 0; i < value.WriterId.Count; i++)
            {
                BookWriter BookWriter = new BookWriter()
                {
                    BookId   = model.Id,
                    WriterId = value.WriterId[i]
                };
                IBookWriterRepository.Create(BookWriter);
            }

            for (int i = 0; i < value.LibraryId.Count; i++)
            {
                BookLibrary BookLibrary = new BookLibrary()
                {
                    BookId    = model.Id,
                    LibraryId = value.LibraryId[i]
                };
                IBookLibraryRepository.Create(BookLibrary);
            }

            for (int i = 0; i < value.PublisherId.Count; i++)
            {
                BookPublisher BookPublisher = new BookPublisher()
                {
                    BookId      = model.Id,
                    PublisherId = value.PublisherId[i]
                };
                IBookPublisherRepository.Create(BookPublisher);
            }
        }
Пример #42
0
 private async void bookLibLibraryListView_ItemClick(object sender, ItemClickEventArgs e)
 {
     BookLibrary bookLibLibrary = e.ClickedItem as BookLibrary;
 }
 public Dashboard(User currentUser, BookLibrary books)
 {
     CurrentUser = currentUser;
     Books       = books;
 }
Пример #44
0
 public BookLibrary DeleteFromLibrary(BookLibrary BookLibrary)
 {
     database.BookLibrary.Remove(BookLibrary);
     database.SaveChanges();
     return(BookLibrary);
 }
        public IActionResult Create([FromBody] BookLibrary newBookLibrary)
        {
            var bookLibrary = _bookLibraryService.Create(newBookLibrary);

            return(Created($"{bookLibrary.Id}", bookLibrary));
        }