Buecherwurm/Catalogue.cs

46 lines
1 KiB
C#
Raw Normal View History

2020-04-23 13:44:38 +00:00
using System;
2020-04-23 12:47:50 +00:00
using System.Collections.Generic;
namespace Bücherwurm
{
class Catalogue
{
private List<Book> Books {get; set;}
2020-04-23 13:44:38 +00:00
private int NextId {get; set;}
2020-04-23 12:47:50 +00:00
public Catalogue()
{
Books = new List<Book>();
2020-04-23 13:44:38 +00:00
NextId = 0;
2020-04-23 12:47:50 +00:00
}
public void Import(string JsonString)
{
2020-04-24 13:54:17 +00:00
throw new NotImplementedException();
2020-04-23 12:47:50 +00:00
}
2020-04-23 13:44:38 +00:00
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);
}
2020-04-24 13:54:17 +00:00
public List<Book> GetBooks()
{
return Books;
}
public Book LookupBook(int BookId)
{
return Books.Find(book => book.BookId == BookId);
}
2020-04-23 12:47:50 +00:00
}
}