Example #1
0
        public CreateDiscardListStatusCodes CreateDiscardList()
        {
            int  condition      = 1;
            bool isBorrowed     = false;
            var  newDiscardList = new List <Book>(bookManager.GetAllBooksWithConditionOne(condition, isBorrowed));

            if (newDiscardList.Count == 0)
            {
                return(CreateDiscardListStatusCodes.NoBooksInConditionOne);
            }
            for (int i = 0; i < newDiscardList.Count; i++)
            {
                var existingDiscardBook = bookManager.GetBookFromDiscardByBook(newDiscardList[i]);
                if (existingDiscardBook == null)
                {
                    var shelf = bookManager.GetShelfFromBook(newDiscardList[i]);
                    bookManager.CreateDiscardList(shelf, newDiscardList[i]);
                }
            }
            return(CreateDiscardListStatusCodes.Ok);
        }