Exemplo n.º 1
0
        public ActionResult Book(int? ID, int? BookPage)
        {
            if (!ID.HasValue)
                return RedirectToAction("Index");
            var book = Books.GetBook(ID.Value);
            BookViewModel model = new BookViewModel();
            model.Book = book;
            model.TotalPages = Books.GetTotalPage(book.ID);

            if (!BookPage.HasValue)
                model.CurrentPage = Books.GetCurrentPage(1, ID.Value);
            else
                model.CurrentPage = Books.GetCurrentPage(BookPage.Value, ID.Value);

            //if (model.CurrentPage == null)
            //{
            //    var editpagemodel = new EditPageViewModel();
            //    editpagemodel.PageNumber = 1;
            //    editpagemodel.BookID = book.ID;
            //    editpagemodel.BookName = book.Name;
            //    return View("EditPage", editpagemodel);
            //}

            model.AccessableFor = Books.GetAllPeopleListHasAccess(book.ID);
            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult EditPage(EditPageViewModel form)
        {
            Books.UpdatePage(form);

            var model = new BookViewModel();
            model.Book = Books.GetBook(form.BookID);
            model.CurrentPage = Books.GetCurrentPage(form.PageNumber, form.BookID);
            model.TotalPages = Books.GetTotalPage(form.BookID);
            model.AccessableFor = Books.GetAllPeopleListHasAccess(form.BookID);
            return View("Book", model);
        }