コード例 #1
0
ファイル: BookController.cs プロジェクト: Gcobani/urbanbooks
        public ActionResult ByCategory(string name, int CategoryID)
        {
            #region Init

            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();
            Book helper = new Book();
            #endregion

            #region Get Books By Category

            if (name != null)
            {
                model.BookResults = myHandler.CategoryBookSearch(name);
                model.BCategory = new BookCategory();
                helper = (Book)model.BookResults.Take(1).FirstOrDefault();
                model.BCategory = myHandler.GetBookType(helper.BookCategoryID);

            }
            else if (CategoryID != 0)
            {
                model.BookResults = myHandler.GetBooksByCategory(CategoryID);
                model.BCategory = new BookCategory();
                model.BCategory = myHandler.GetBookType(CategoryID);
            }

            #endregion

            return View(model);
        }
コード例 #2
0
ファイル: BookController.cs プロジェクト: Gcobani/urbanbooks
        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);
        }