예제 #1
0
        public static void Delete(PaperType paperType, int id)
        {
            switch (paperType)
            {
            case PaperType.Book:
                BookStorage.DeleteById(id);
                break;

            case PaperType.Jornal:
                JornalStorage.DeleteById(id);
                break;

            case PaperType.NewsPaper:
                NewsPaperStorage.DeleteById(id);
                break;
            }
        }
예제 #2
0
        public static void Add(TextPaper item)
        {
            if (item.GetType() == typeof(Book))
            {
                BookStorage.AddItem(item as Book);
                return;
            }

            if (item.GetType() == typeof(Jornal))
            {
                JornalStorage.AddItem(item as Jornal);
                return;
            }

            if (item.GetType() == typeof(NewsPaper))
            {
                NewsPaperStorage.AddItem(item as NewsPaper);
                return;
            }
        }
예제 #3
0
        public static TextPaper Read(PaperType paperType, int id)
        {
            switch (paperType)
            {
            case PaperType.Book:
                return(BookStorage.GetById(id) as TextPaper);

                break;

            case PaperType.Jornal:
                return(JornalStorage.GetById(id) as TextPaper);

                break;

            case PaperType.NewsPaper:
                return(NewsPaperStorage.GetById(id) as TextPaper);

                break;
            }
            return(null);
        }
예제 #4
0
 public static void Save()
 {
     BookStorage.SaveToRepository();
     JornalStorage.SaveToRepository();
     NewsPaperStorage.SaveToRepository();
 }