Buecherwurm/Lend_Administration.cs

32 lines
752 B
C#
Raw Normal View History

2020-04-23 12:47:50 +00:00
using System.Collections.Generic;
namespace Bücherwurm
{
class Lend_Administration
{
private List<Lending> Lendings {get; set;}
2020-04-23 13:44:38 +00:00
private List<int> ActiveLendings {get; set;}
private int NextId {get; set;}
2020-04-23 12:47:50 +00:00
public Lend_Administration()
{
Lendings = new List<Lending>();
2020-04-23 13:44:38 +00:00
ActiveLendings = new List<int>();
NextId = 0;
2020-04-23 12:47:50 +00:00
}
2020-04-23 13:44:38 +00:00
public void Lend(int[] ItemIds, string Customer)
2020-04-23 12:47:50 +00:00
{
2020-04-23 13:44:38 +00:00
Lendings.Add(new Lending(NextId, ItemIds, Customer));
ActiveLendings.Add(NextId);
NextId = NextId++;
2020-04-23 12:47:50 +00:00
}
public void Return(int LendID)
{
2020-04-23 13:44:38 +00:00
ActiveLendings.RemoveAll(id => id == LendID);
2020-04-23 12:47:50 +00:00
}
}
}