Example #1
0
        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;
            }
        }
Example #2
0
        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);
        }
Example #3
0
        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);
            }
        }
Example #4
0
 internal override bool LoanPublication(string ISBN, Member Member)
 {
     Mock.MockPublications Publications = new Mock.MockPublications();
     return Publications.SetPublicationAsLoaned(ISBN, Member);
 }
Example #5
0
 internal override bool ReturnPublication(string ISBN, Member Member)
 {
     Mock.MockPublications Publications = new Mock.MockPublications();
     return Publications.UpdatePublicationStatus(ISBN, Member, "Return");
 }
Example #6
0
 internal abstract bool ReturnPublication(string ISBN, Member Member);
Example #7
0
 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;
 }