public bool SetPublicationAsLoaned(string ISBN, Member Member) { try { List<Publication> listOfPublications = MockListPublications() .Where(l => l.ISBN == ISBN & l.reserved == false) .ToList(); Publication Publication = listOfPublications .Where(l => l.ISBN == ISBN & l.reserved == false) .FirstOrDefault(); listOfPublications .Remove(Publication); //DB logic - save record to link Member with Publication GUID return true; } catch(Exception ex) { return false; } }
public void ReturnPublication() { LoanAccountBook account = new LoanAccountBook(); Member Member = new Member(); Member.MemberName = "Nick Gowdy"; Member.MemberId = Guid.NewGuid(); account.ReturnPublication("0-330-28498-3", Member); }
public void LoanPublication() { LoanAccountBook account = new LoanAccountBook(); Member Member = new Member(); Member.MemberName = "Nick Gowdy"; Member.MemberId = Guid.NewGuid(); bool isReserved = account.IsReserved("0-330-28498-3"); if (!isReserved) { bool LoanSuccess = account.LoanPublication("0-330-28498-3", Member); } }
internal override bool LoanPublication(string ISBN, Member Member) { Mock.MockPublications Publications = new Mock.MockPublications(); return Publications.SetPublicationAsLoaned(ISBN, Member); }
internal override bool ReturnPublication(string ISBN, Member Member) { Mock.MockPublications Publications = new Mock.MockPublications(); return Publications.UpdatePublicationStatus(ISBN, Member, "Return"); }
internal abstract bool ReturnPublication(string ISBN, Member Member);
public bool UpdatePublicationStatus(string ISBN, Member Member, string choice) { bool SqlOutcome = false; switch(choice.ToLower()) { case "return": // DB logic call goes here to update the Member record to say he isn't loaning the book anymore // Update publication table to say it's available again DataLayer DL = new DataLayer(); SqlOutcome = DL.SetPublicationStatus(ISBN, Member); break; } return SqlOutcome; }