Esempio n. 1
0
        public JsonResult Edit(int bookId, BookFormDto bookFormDto)
        {
            if (ModelState.IsValid)
            {
                bookPilotageService.AddOrUpdateBook(bookFormDto, bookId);

                var bookIndexDto = bookPilotageService.GetBookIndexDto(bookId);
                var html         = PartialView("views/pilotage/books/_Index_Book.cshtml", bookIndexDto).Render(this.HttpContext);
                var data         = new
                {
                    BookId = bookId,
                    Html   = html
                };

                return(Json(data));
            }

            return(GetBookFormBody(bookFormDto));
        }
Esempio n. 2
0
        public JsonResult Edit(int bookId, BookFormDto bookFormDto)
        {
            if (ModelState.IsValid)
            {
                bookPilotageService.AddOrUpdateBook(bookFormDto, bookId);

                var bookIndexDto = bookPilotageService.GetBookIndexDto(bookId);
                var html         = ViewRenderer.RenderPartialView("_Index_Book", bookIndexDto, this.ControllerContext);
                var data         = new
                {
                    BookId = bookId,
                    Html   = html
                };

                var jsonResponse = new JsonResponse(data);

                return(Json(jsonResponse, JsonRequestBehavior.AllowGet));
            }

            return(GetBookFormBody(bookFormDto));
        }