You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
858 B
34 lines
858 B
|
3 years ago
|
using w21library.classes.Intf;
|
||
|
|
|
||
|
|
namespace w21library.classes
|
||
|
|
{
|
||
|
|
public class Library : ILibrary
|
||
|
|
{
|
||
|
|
protected List<Book> BookList = new List<Book>();
|
||
|
|
public IEnumerable<IBook> GetActiveBooks()
|
||
|
|
{
|
||
|
|
List<Book> activeBookList = new List<Book>();
|
||
|
|
foreach (var book in BookList)
|
||
|
|
{
|
||
|
|
activeBookList.Add(book);
|
||
|
|
}
|
||
|
|
return activeBookList;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool RemoveBook(string guid)
|
||
|
|
{
|
||
|
|
var book = BookList.FirstOrDefault(p => p.Uuid.Equals(guid));
|
||
|
|
if (book == null) return false;
|
||
|
|
return BookList.Remove(book);
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool AddBook(string name, string author)
|
||
|
|
{
|
||
|
|
var book = new Book(author, name);
|
||
|
|
BookList.Add(book);
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|