Buecherwurm/Catalogue.cs
2020-04-24 15:54:17 +02:00

46 lines
No EOL
1 KiB
C#

using System;
using System.Collections.Generic;
namespace Bücherwurm
{
class Catalogue
{
private List<Book> Books {get; set;}
private int NextId {get; set;}
public Catalogue()
{
Books = new List<Book>();
NextId = 0;
}
public void Import(string JsonString)
{
throw new NotImplementedException();
}
public void Add(string Title, string Author,
string Country, string ILink, string Link,
string Language, int Pages, int Year)
{
Books.Add(new Book(NextId, Title, Author, Country, ILink, Link, Language, Pages, Year));
NextId = NextId++;
}
public void Remove(int BookID)
{
Books.RemoveAll(book => book.BookId == BookID);
}
public List<Book> GetBooks()
{
return Books;
}
public Book LookupBook(int BookId)
{
return Books.Find(book => book.BookId == BookId);
}
}
}