42 lines
No EOL
1 KiB
C#
42 lines
No EOL
1 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Bücherwurm
|
|
{
|
|
class Lend_Administration
|
|
{
|
|
private List<Lending> Lendings {get; set;}
|
|
|
|
private List<int> ActiveLendings {get; set;}
|
|
|
|
private int NextId {get; set;}
|
|
|
|
public Lend_Administration()
|
|
{
|
|
Lendings = new List<Lending>();
|
|
ActiveLendings = new List<int>();
|
|
NextId = 1;
|
|
}
|
|
|
|
public void Lend(int ItemId, string Customer, int timeInDays)
|
|
{
|
|
Lendings.Add(new Lending(NextId, ItemId, Customer, timeInDays));
|
|
ActiveLendings.Add(NextId);
|
|
NextId = NextId + 1;
|
|
}
|
|
|
|
public void Return(int LendID)
|
|
{
|
|
ActiveLendings.RemoveAll(id => id == LendID);
|
|
}
|
|
|
|
public List<Lending> GetAllLendings()
|
|
{
|
|
return Lendings;
|
|
}
|
|
|
|
public List<Lending> GetActiveLendings()
|
|
{
|
|
return Lendings.FindAll(lend => ActiveLendings.Contains(lend.LendId));
|
|
}
|
|
}
|
|
} |