Esempio n. 1
0
        public static int VerifyInsertLibraryItem(ItemModel itemModel, string category)
        {
            int itemInsertStatus = 0;
            var userRole         = GetUserRole(itemModel.AuthToken);

            if (userRole != 0)
            {
                return(-1);
            }

            switch (category)
            {
            case "book":
                itemModel.Category = category;
                itemInsertStatus   = BookProcessor.SetBook(itemModel);
                break;

            case "newspaper":
                itemModel.Category = category;
                itemInsertStatus   = NewspaperProcessor.SetNewspaper(itemModel);
                break;

            case "magazine":
                itemModel.Category = category;
                itemInsertStatus   = MagazineProcessor.SetMagazine(itemModel);
                break;

            case "journal":
                itemModel.Category = category;
                itemInsertStatus   = JournalProcessor.SetJournal(itemModel);
                break;

            case "manuscript":
                itemModel.Category = category;
                itemInsertStatus   = ManuscriptProcessor.SetManuscript(itemModel);
                break;
            }

            return(itemInsertStatus);
        }