Example #1
0
        public ActionResult Books(int AuthorID)
        {
            #region Prep Utilities

            myHandler = new BusinessLogicHandler();
            AddNewBookViewModel model = new AddNewBookViewModel();

            #endregion

            #region Get Books

            model.bookList = new List<Book>();
            model.bookList = myHandler.GetBooksByAuthor(AuthorID);

            #endregion

            #region Get Author Data

            model.author = new Author();
            model.author = myHandler.GetAuthorDetails(AuthorID);

            #endregion

            return View(model);
        }
Example #2
0
 public ActionResult Delete(int AuthorID)
 {
     myHandler = new BusinessLogicHandler();
     author = new Author();
     author.AuthorID = AuthorID;
     author = myHandler.GetAuthorDetails(AuthorID);
     return View(author);
 }
Example #3
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);
        }