Ejemplo n.º 1
0
        // GET: Production/Sections
        public IActionResult Index()
        {
            var sections = this.sectionsService.GetAll <SectionIndexViewModel>();
            var viewModel = new SectionsListViewModel {
                Sections = sections
            }.Sections;

            return(this.View(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult List(int?bookId)
        {
            SectionsListViewModel model = new SectionsListViewModel();

            model.Books = repository.GetBooks(User.Identity.Name).OrderBy(b => b.Title);
            if (bookId == null)
            {
                model.BookId = model.Books.FirstOrDefault().BookId;
            }
            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult List(SectionsListViewModel model)
        {
            Book book = repository.GetBooks(User.Identity.Name).FirstOrDefault(b => b.BookId == model.BookId);

            if (book != null &&
                model.NewSectionStartPageNumber >= 1 &&
                model.NewSectionEndPageNumber <= book.Pages &&
                model.NewSectionStartPageNumber <= model.NewSectionEndPageNumber &&
                !String.IsNullOrWhiteSpace(model.NewSectionName))
            {
                repository.AddSection(model.BookId ?? 0, model.NewSectionName, model.NewSectionStartPageNumber ?? 0, model.NewSectionEndPageNumber ?? 0, User.Identity.Name);
            }
            return(RedirectToAction("List", new { BookId = model.BookId }));
        }