//allows you to remove elements thanks to the ISBN (unic) to the collection and know if it was successfull public bool Remove(AbstractItem absItem) { int index; try { index = _absItemList.FindIndex((c) => c.ISBN == absItem.ISBN); } catch (Exception) { return(false); } if (index != default(int)) { return(Remove(index)); } else { return(false); } }
//mostly used in testing internal RentedItem(AbstractItem item, User user, DateTime date) { _user = user; _item = item; _rentedDay = date; }
//Allow to add directly an item and a user as a Rented Item. public void Add(AbstractItem absItem, User user) { RentedItem _tmp = new RentedItem(absItem, user); _rentItemList.Add(_tmp); }
//mostly used in the code, allow to fix the rented Date directly as today public RentedItem(AbstractItem item, User user) { _user = user; _item = item; _rentedDay = DateTime.Now; }