public CopyStatus RentCopy(string copyCode, string userCode) { Copy copyToRent = GetCopy(copyCode); if(copyToRent == null) throw new Exception("Brak egzemplarza o taki numerze!"); if (!copyToRent.Condition.Equals(Conditions.Avaliable)) throw new Exception("Egzemplarz niedostępny do wypożyczenia!"); User rentingUser = GetUser(userCode); if(rentingUser == null) throw new Exception("Brak uzytkownika o danym numerze!"); CopyStatus copyToReturn = new CopyStatus(); copyToReturn.RentTime = DateTime.Now; copyToReturn.ReturnTime = (DateTime.Now).AddMonths(1); copyToReturn.RentBy = rentingUser; copyToReturn.DaysDelay = 0; copyToReturn.Copy = copyToRent; if(InsertNewCopyStatus(copyToReturn)) return copyToReturn; return null; }
public bool InsertNewCopyStatus(CopyStatus statusToInsert) { return true; }
public void DeleteCopyStatus(CopyStatus copyStatus) { }