Example #1
0
        public static int VerifyUpdateLibraryItem(string token, int id, string type, string value, string category)
        {
            int itemUpdateStatus = 0;
            var userRole         = GetUserRole(token);

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

            switch (category)
            {
            case "book":
                itemUpdateStatus = BookProcessor.UpdateBook(id, type, value);
                break;

            case "newspaper":
                itemUpdateStatus = NewspaperProcessor.UpdateNewspaper(id, type, value);
                break;

            case "magazine":
                itemUpdateStatus = MagazineProcessor.UpdateMagazine(id, type, value);
                break;

            case "journal":
                itemUpdateStatus = JournalProcessor.UpdateJournal(id, type, value);
                break;

            case "manuscript":
                itemUpdateStatus = ManuscriptProcessor.UpdateManuscript(id, type, value);
                break;
            }

            return(itemUpdateStatus);
        }
Example #2
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);
        }