Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 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 { }
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
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);
        }