public void Get()
        {
            var manager = new ComicStripManager(new UnitOfWork("development"));

            manager.DeleteAll();
            var publisherManager = new PublisherManager(new UnitOfWork("development"));

            publisherManager.DeleteAll();
            publisherManager.Add(new Publisher("test-publisher"));

            var AuthorManager = new AuthorManager(new UnitOfWork("development"));

            AuthorManager.DeleteAll();

            AuthorManager.Add(new Author("test-author", "test-author"));

            manager.Add(new BusinessLayer.Models.ComicStrip("test-strip", new ComicstripSerie("testSerie"), 5, AuthorManager.GetAll(), publisherManager.GetAll()[0]));
            var comic = manager.GetAll();

            var bundleManager = new ComicstripBundleManager(new UnitOfWork("development"));

            bundleManager.DeleteAll();
            bundleManager.Add(new ComicstripBundle("test-bundle", comic, publisherManager.GetAll()[0]));
            var bundles = bundleManager.GetAll();
            var bundle  = bundleManager.Get(bundles[0].ID);

            Assert.AreEqual(bundles.Count, 1);
            Assert.AreEqual(bundle.Titel, "test-bundle");
            Assert.AreEqual(bundle.Comicstrips.Count, 1);

            manager.DeleteAll();
            AuthorManager.DeleteAll();
            bundleManager.DeleteAll();
        }
        public IEnumerable <PublisherModel> Get()
        {
            var publishers = publishermanager.GetAll();
            var results    = publishers.Select(publisher => modelfactory.Create(publisher));

            return(results);
        }
        public ViewHome()
        {
            InitializeComponent();

            ComicStripManager sm = new ComicStripManager(new UnitOfWork());

            Comicstrips = new StripGrid(StripsGrid, sm.GetAll());
            Comicstrips.SetDeleteButton(Button_DeleteStrips);
            Comicstrips.SetEditButton(Button_EditStrip);

            AuthorManager am = new AuthorManager(new UnitOfWork());

            Authors = new AuthorGrid(AuthorsGrid, am.GetAll());
            Authors.SetDeleteButton(Button_DeleteAuthors);
            Authors.SetEditButton(Button_EditAuthor);

            PublisherManager pm = new PublisherManager(new UnitOfWork());

            Publishers = new PublisherGrid(PublishersGrid, pm.GetAll());
            Publishers.SetDeleteButton(Button_DeletePublishers);
            Publishers.SetEditButton(Button_EditPublisher);

            ComicstripBundleManager bm = new ComicstripBundleManager(new UnitOfWork());

            Bundles = new BundleGrid(BundlesGrid, bm.GetAll());
            Bundles.SetDeleteButton(Button_DeleteBundles);
            Bundles.SetEditButton(Button_EditBundles);
        }
        public ComicstripBundleAddForm(TextBox title, ComboBox publisher, DataGrid comicstrips, Button submit)
        {
            this.TitleInput                       = title;
            this.TitleInput.TextChanged          += InputChanged;
            this.PublisherInput                   = publisher;
            this.PublisherInput.SelectionChanged += InputChanged;
            ComicStripManager sm = new ComicStripManager(new UnitOfWork());

            this.ComicstripsInput = new StripGrid(comicstrips, sm.GetAll());
            this.ComicstripsInput.Grid.SelectionChanged += InputChanged;
            this.SubmitButton        = submit;
            this.SubmitButton.Click += Submit;

            PublisherManager pm = new PublisherManager(new UnitOfWork());

            this.publishers = pm.GetAll();
            foreach (Publisher p in this.publishers)
            {
                this.PublisherInput.Items.Add(p.Name);
            }
        }
        public ComicstripAddForm(TextBox title, CheckBox serieSwitcher, ComboBox serieSelect, TextBox serieNew, TextBox number, ComboBox publisher, DataGrid authors, Button submit)
        {
            this.TitleInput                         = title;
            this.TitleInput.TextChanged            += InputChanged;
            this.SerieInputSelect                   = serieSelect;
            this.SerieInputSelect.SelectionChanged += InputChanged;
            this.SerieInputNew                      = serieNew;
            this.SerieInputNew.TextChanged         += InputChanged;
            this.SerieSwitcher                      = serieSwitcher;
            this.SerieSwitcher.Click               += InputChanged;
            this.NumberInput                        = number;
            this.NumberInput.TextChanged           += InputChanged;
            this.PublisherInput                     = publisher;
            this.PublisherInput.SelectionChanged   += InputChanged;
            AuthorManager am = new AuthorManager(new UnitOfWork());

            this.AuthorsInput = new AuthorGrid(authors, am.GetAll());
            this.AuthorsInput.Grid.SelectionChanged += InputChanged;
            this.SubmitButton        = submit;
            this.SubmitButton.Click += Submit;

            ComicStripManager cm = new ComicStripManager(new UnitOfWork());

            this.series = cm.GetAllSeries();
            foreach (ComicstripSerie serie in this.series)
            {
                this.SerieInputSelect.Items.Add(serie.Name);
            }
            PublisherManager pm = new PublisherManager(new UnitOfWork());

            this.publishers = pm.GetAll();
            foreach (Publisher p in this.publishers)
            {
                this.PublisherInput.Items.Add(p.Name);
            }
        }
示例#6
0
        public void DeleteByID()
        {
            var manager = new ComicStripManager(new UnitOfWork("development"));

            manager.DeleteAll();
            var publisherManager = new PublisherManager(new UnitOfWork("development"));

            publisherManager.DeleteAll();
            publisherManager.Add(new Publisher("test-publisher"));

            var AuthorManager = new AuthorManager(new UnitOfWork("development"));

            AuthorManager.DeleteAll();
            AuthorManager.Add(new Author("test-author", "test-author"));

            manager.Add(new BusinessLayer.Models.ComicStrip("test-strip", new ComicstripSerie("testSerie"), 5, AuthorManager.GetAll(), publisherManager.GetAll()[0]));
            var comic = manager.GetAll();

            Assert.AreEqual(comic.Count, 1);
            var comc = manager.Get(comic[0].ID);

            Assert.AreEqual(comc.Titel, "test-strip");
            Assert.AreEqual(comc.Number, 5);
            manager.Delete(comc.ID);
            comic = manager.GetAll();
            Assert.AreEqual(comic.Count, 0);

            publisherManager.DeleteAll();
            AuthorManager.DeleteAll();
            manager.DeleteAll();
        }