Пример #1
0
 public ActionResult Delete(int PublisherID)
 {
     myHandler = new BusinessLogicHandler();
     publisher = new Publisher();
     publisher.PublisherID = PublisherID;
     publisher = myHandler.GetPublisher(PublisherID);
     return View(publisher);
 }
Пример #2
0
        public ActionResult CustomerDetails(int ProductID)
        {
            #region Prep Utilities

            myHandler = new BusinessLogicHandler();
            AddNewBookViewModel model = new AddNewBookViewModel();
            book = new Book();
            BookCategory category = new BookCategory();
            Publisher pub = new Publisher();
            Author authors = new Author();

            #endregion

            #region Check Type
            if (myHandler.CheckProductType(ProductID))
            { }
            else
            { return RedirectToAction("Details","Technology", new { ProductID = ProductID }); }
            #endregion

            #region Get Book Data

            book = myHandler.User_GetBook(ProductID);
            model.books = new Book();
            model.books = book;
            model.bookList = new List<Book>();
            model.bookList.Add(book);

            #endregion

            #region Get Book Category Data

            category = myHandler.GetBookType(book.BookCategoryID);
            model.bc = new BookCategory();
            model.bc = category;
            model.bookCategoryList = new List<BookCategory>();
            model.bookCategoryList.Add(category);

            #endregion

            #region Get Publisher Data

            pub = myHandler.GetPublisher(book.PublisherID);
            model.publisher = new Publisher();
            model.publisher = pub;
            model.PublisherList = new List<Publisher>();
            model.PublisherList.Add(pub);

            #endregion

            #region Get Authors Data

            model.AuthorList = myHandler.GetAuthorsPerBook(book.BookID);

            #endregion

            return View(model);
        }
Пример #3
0
 public ActionResult Details(int id)
 {
     BusinessLogicHandler myHandler = new BusinessLogicHandler();
     Publisher publisher = new Publisher();
     publisher = myHandler.GetPublisher(id);
     return View(publisher);
 }
Пример #4
0
        public ActionResult Product(int ProductID)
        {

            #region Prep Utilities
            myHandler = new BusinessLogicHandler();
            UnifiedViewModel model = new UnifiedViewModel();
            Author Author = new Author();
            #endregion

            #region Config Roles
            if(User.IsInRole("supplier"))
            {
                model.iSupplier = true;
            }
            #endregion

            #region Get the Data
            if (myHandler.CheckProductType(ProductID))
            {
                model.Book = new Book();
                model.Book = myHandler.GetBook(ProductID);
                model.BookCategory = new BookCategory();
                model.BookCategory = myHandler.GetBookCategory(model.Book.BookCategoryID);
                model.Publisher = new Publisher();
                model.Publisher = myHandler.GetPublisher(model.Book.PublisherID);
                IEnumerable<BookAuthor> authorsINbook = myHandler.GetBookAuthors(model.Book.BookID);
                model.Authors = new List<Author>();
                foreach(var item in authorsINbook)
                {
                    Author = myHandler.GetAuthorDetails(item.AuthorID);
                    model.Authors.Add(Author);
                }
            }
            else
            {
                model.Device = new Technology();
                model.Device = myHandler.GetTechnologyDetails(ProductID);
                model.Manufacturer = new Manufacturer();
                model.Manufacturer = myHandler.GetManufacturer(model.Device.ManufacturerID);
                model.Category = new TechCategory();
                model.Category = myHandler.GetTechnologyType(model.Device.TechCategoryID);
            }
            #endregion

            return View(model);
        }