コード例 #1
0
        public ActionResult AddBook()
        {
            var profileData = Session["UserProfile"] as UserSession;

            if (profileData == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var publicationRepository   = new PublicationRepository();
            var contentRatingRepository = new ContentRatingRepository();
            var authorRepository        = new AuthorRepository();
            var bookDetail = new BookDetails();
            var bookModel  = new BookModel();

            ModelState.Clear();

            bookModel.PublicationList   = publicationRepository.GetAllPublication();
            bookModel.ContentRatingList = contentRatingRepository.GetAllContentRating();
            bookModel.BookTypeList      = new List <String>()
            {
                "Reference Book",
                "Loan Book"
            };

            bookDetail.BookModel  = bookModel;
            bookDetail.AuthorList = authorRepository.GetAllAuthor();

            return(View(bookDetail));
        }
        public ActionResult EditPublicationDetails(int id)
        {
            var profileData = Session["UserProfile"] as UserSession;

            if (profileData == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            PublicationRepository pubRepo = new PublicationRepository();

            return(View(pubRepo.GetAllPublication().Find(pub => pub.PublicationId == id)));
        }
        public ActionResult GetAllPublicationDetails()
        {
            var profileData = Session["UserProfile"] as UserSession;

            if (profileData == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            PublicationRepository pubRepo = new PublicationRepository();

            ModelState.Clear();
            return(View(pubRepo.GetAllPublication()));
        }