Exemplo n.º 1
0
        public bool AddSection(int sectionNumber)
        {
            var existingSection = sectionManager.GetSectionBySectionNumber(sectionNumber);

            if (existingSection != null)
            {
                return(false);
            }

            sectionManager.AddSection(sectionNumber);
            return(true);
        }
Exemplo n.º 2
0
        public GetScrapListCodes GetScrapList(int sectionNumber, int shelfNumber,
                                              string bookName, bool inLibrary, int bookCondition)
        {
            var newSection = sectionManager.GetSectionBySectionNumber(sectionNumber);

            if (newSection == null)
            {
                return(GetScrapListCodes.HasNoSections);
            }

            var newShelf = shelfManager.GetShelfByShelfNumber(shelfNumber);

            if (newShelf == null)
            {
                return(GetScrapListCodes.HasNoShelfs);
            }

            var newBook = bookManager.GetBookByName(bookName, inLibrary, bookCondition);

            if (newBook == null)
            {
                return(GetScrapListCodes.HasNoBooks);
            }

            if (newBook.BookCondition > 1)
            {
                return(GetScrapListCodes.BookConditionIsTooHigh);
            }

            if (newBook.InLibrary == false)
            {
                return(GetScrapListCodes.BookIsBorrowed);
            }

            sectionManager.GetScrapList();
            return(GetScrapListCodes.Ok);
        }