A command-line based library management utility.
- .NET 5.0 (preferably the latest revision).
- An IDE of your choice.
A list of commands and their parameters.
⚠ Parameters between [] brackets are required.
Commands can be chained like so: -add file.json -list isbn=xxxxxxx
-
-add[path to json file containing book model]Adds book from .json file to the library, if said book exists - updates it's amount.
-
-take[holder] [time from : yyyy-mm-dd] [time to : yyyy-mm-dd] [isbn]Creates lease record and takes book by
[isbn]from library.Taking more than 3 books per person is not allowed, neither is leasing a book for longer than 2 months.
-
-return[holder] [time from : yyyy-mm-dd] [time to : yyyy-mm-dd] [isbn]Returns the book when provided with the same parameters as in
-takecommand.The application is aware of late returns.
-
-listlists books filtered using any number optional parameters below:-
author=[author] -
category=[category] -
language=[language] -
isbn=[isbn] -
name=[name] -
issued=[true/false]Both
trueandfalsewill return a list of books, however theAmountproperty will show:- if
true- the amount of issues of said book. - if
false- the amount of free remaining copies in the library
- if
-
-
-delete[isbn] [amount : int]Updates the amount of books with
[isbn]accordingly, if no one is leasing said book and it's amount reaches 0 - it's deleted entirely and can only be reintroduced using-addcommand. -
-help
-
-add-add file.jsonwhenfile.jsonlooks like:{ "Name": "Random Book", "Author": "Randy", "Category": "Parody", "Language": "French", "PublicationDate": "2008-06-26", "ISBN": "471658197-X" }Property
"Amount"=[amount : int]can also be added to specify how many copies said edition of book has. If it isn't provided - the default is 1.Output:
Book { Name = Random Book, Author = Randy, Category = Parody, Language = French, PublicationDate = 6/26/2008 12:00:00 AM, ISBN = 471658197-X, Amount = 1 } added successfully! -
-take-take "John smith" 2022-11-23 2022-12-20 471658197-X:Book { Name = Random Book, Author = Randy, Category = Parody, Language = French, PublicationDate = 6/26/2008 12:00:00 AM, ISBN = 471658197-X, Amount = 1 } issued successfully.In case duration of the lease exceeds 2 months:
Library.ConsoleException: Cannot take a book for longer than 2 months. ...In case the same person has leased 3 books and is trying to take 4th one:
Library.ConsoleException: A single person can have no more than 3 books at once! Please return one of them. ... -
-return-return "John smith" 2022-11-23 2022-12-20 471658197-XOutput:
Book { Name = Random Book, Author = Randy, Category = Parody, Language = French, PublicationDate = 6/26/2008 12:00:00 AM, ISBN = 471658197-X, Amount = 1 } successfully returned and Issue { Holder = John smith, From = 11/23/2022 12:00:00 AM, To = 12/20/2022 12:00:00 AM, ISBN = 471658197-X } is removed.In case the return is late the normal output is prepended with:
Aren't we cheeky? ... -
-list-list issued=trueafter using-takeexample:Book { Name = Random Book, Author = Randy, Category = Parody, Language = French, PublicationDate = 6/26/2008 12:00:00 AM, ISBN = 471658197-X, Amount = 1 }-list issued=falseafter using-returnexample:... Book { Name = Random Book, Author = Randy, Category = Parody, Language = French, PublicationDate = 6/26/2008 12:00:00 AM, ISBN = 471658197-X, Amount = 1 } -
-delete-delete 471658197-X 1:Successfully removed Book { Name = Random Book, Author = Randy, Category = Parody, Language = French, PublicationDate = 6/26/2008 12:00:00 AM, ISBN = 471658197-X, Amount = 1 }.