public ActionResult CreateBook(AddBookViewModel form)
        {
            if (ModelState.IsValid)
            {
                var book = Books.AddBook(form);

                EditPageViewModel model = new EditPageViewModel();
                model.BookID = book.ID;
                model.PageNumber = 1;
                return View("EditPage", model);
            }
            else
            {
                return View(form);
            }
        }
Beispiel #2
0
 public static void UpdatePage(EditPageViewModel form)
 {
     try
     {
         var context = new ClanographyContext();
         var page = context.Pages.SingleOrDefault(i => i.ID == form.ID);
         page.ModifiedDate = DateTime.Now;
         page.ModifierEmail = HttpContext.Current.User.Identity.Name;
         page.Name = form.Name;
         page.PageNumber = form.PageNumber;
     }
     catch { }
 }
 public ActionResult EditPage(int? BookID, int? BookPage)
 {
     if (BookID.HasValue && BookPage.HasValue)
     {
         var model = new EditPageViewModel();
         model.BookID = BookID.Value;
         model.PageNumber = BookPage.Value;
         return View(model);
     }
     return View();
 }
        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);
        }