コード例 #1
0
        public void AddBook(AddGeneralViewModel view)
        {
            var addBookViewModel = new AddBookViewModel();

            addBookViewModel.Author              = view.Author;
            addBookViewModel.NumberPages         = view.NumberPages;
            addBookViewModel.PublicationName     = view.PublicationName;
            addBookViewModel.PublishingHousesIds = view.PublishingHousesIds;
            addBookViewModel.PublishingYear      = view.PublishingYear;
            var publication = InsertPablication(addBookViewModel);

            InsertBook(addBookViewModel, publication);
            InsertPublicationInPublisihngHouse(addBookViewModel, publication);
        }
コード例 #2
0
        public void AddMagazine(AddGeneralViewModel view)
        {
            var addMagazineViewModel = new AddMagazineViewModel();

            addMagazineViewModel.MagazineNumber      = view.MagazineNumber;
            addMagazineViewModel.PublicationDate     = view.PublicationDate;
            addMagazineViewModel.PublicationName     = view.PublicationName;
            addMagazineViewModel.PublishingHousesIds = view.PublishingHousesIds;

            var publication = InsertPablication(addMagazineViewModel);

            InsertMagazine(addMagazineViewModel, publication);
            InsertPublicationInPublisihngHouse(addMagazineViewModel, publication);
        }
コード例 #3
0
        public void AddBrochure(AddGeneralViewModel view)
        {
            var addBrochureViewModel = new AddBrochureViewModel();

            addBrochureViewModel.CoverType           = view.CoverType;
            addBrochureViewModel.NumberPages         = view.NumberPages;
            addBrochureViewModel.PublicationName     = view.PublicationName;
            addBrochureViewModel.PublishingHousesIds = view.PublishingHousesIds;
            addBrochureViewModel.PublishingYear      = view.PublishingYear;
            addBrochureViewModel.TomFilling          = view.TomNumber;
            var publication = InsertPablication(addBrochureViewModel);

            InsertBrochure(addBrochureViewModel, publication);
            InsertPublicationInPublisihngHouse(addBrochureViewModel, publication);
        }
コード例 #4
0
 public ActionResult Add(AddGeneralViewModel view)
 {
     if (view == null)
     {
         return(RedirectToAction("Index", "General"));
     }
     if (view.Type == PublicationType.Book)
     {
         _service.AddBook(view);
     }
     if (view.Type == PublicationType.Brochure)
     {
         _service.AddBrochure(view);
     }
     if (view.Type == PublicationType.Magazine)
     {
         _service.AddMagazine(view);
     }
     return(RedirectToAction("Index", "General"));
 }