コード例 #1
0
ファイル: ShelfAPI.cs プロジェクト: david-karlsson/ExamUppgV2
        public RemoveShelfErrorCodes RemoveShelf(int shelfNumber)
        {
            var newShelf = shelfManager.GetShelfByNumber(shelfNumber);

            if (newShelf.Book.Count > 0)
            {
                return(RemoveShelfErrorCodes.ShelfHasBooks);
            }

            shelfManager.RemoveShelf(newShelf.ShelfID);

            return(RemoveShelfErrorCodes.OK);
        }
コード例 #2
0
        public ShelfStatusCodes RemoveShelf(int shelfNumber, int aisleNumber)
        {
            var newShelf = shelfManager.GetShelfByShelfNumber(shelfNumber, aisleNumber);

            if (newShelf == null)
            {
                return(ShelfStatusCodes.NoSuchShelf);
            }
            if (newShelf.Book.Count > 0)
            {
                return(ShelfStatusCodes.ShelfHasBooks);
            }

            shelfManager.RemoveShelf(newShelf.ShelfID);
            return(ShelfStatusCodes.Ok);
        }
コード例 #3
0
        public RemoveShelfErrorCodes RemoveShelf(int shelfNumber, int bookNumber, int pathID)
        {
            var newShelf = shelfManager.GetShelfByShelfNumber(shelfNumber, pathID);

            if (newShelf == null)
            {
                return(RemoveShelfErrorCodes.NoSuchShelf);
            }
            if (newShelf.Books.Count > 0)
            {
                return(RemoveShelfErrorCodes.ShelfHasBooks);
            }

            shelfManager.RemoveShelf(newShelf.ShelfID);
            return(RemoveShelfErrorCodes.Ok);
        }
コード例 #4
0
        public ShelfErrorCodes RemoveShelf(int shelfID)
        {
            var shelf = shelfManager.GetShelf(shelfID);

            if (shelf == null)
            {
                return(ShelfErrorCodes.NoSuchShelf);
            }
            else
            {
                if (shelf.Books != null)
                {
                    return(ShelfErrorCodes.TheShelfContainsBooks);
                }
                else
                {
                    shelfManager.RemoveShelf(shelf);
                }
                return(ShelfErrorCodes.ok);
            }
        }