Browse Source

Merge pull request #1348 from StevenOwenNell/dev

Correction to documentation
pull/1363/head
Halil İbrahim Kalkan 7 years ago
committed by GitHub
parent
commit
836065026a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      docs/en/Tutorials/AspNetCore-Mvc/Part-II.md

20
docs/en/Tutorials/AspNetCore-Mvc/Part-II.md

@ -32,7 +32,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Acme.BookStore.Web.Pages.Books namespace Acme.BookStore.Web.Pages.Books
{ {
public class CreateModalModel : BookStorePageModelBase public class CreateModalModel : BookStorePageModel
{ {
[BindProperty] [BindProperty]
public CreateUpdateBookDto Book { get; set; } public CreateUpdateBookDto Book { get; set; }
@ -53,7 +53,7 @@ namespace Acme.BookStore.Web.Pages.Books
} }
```` ````
* This class is derived from the `BookStorePageModelBase` instead of standard `PageModel`. `BookStorePageModelBase` inherits the `PageModel` and adds some common properties/methods those can be used by your page model classes. * This class is derived from the `BookStorePageModel` instead of standard `PageModel`. `BookStorePageModel` inherits the `PageModel` and adds some common properties/methods those can be used by your page model classes.
* `[BindProperty]` attribute on the `Book` property binds post request data to this property. * `[BindProperty]` attribute on the `Book` property binds post request data to this property.
* This class simply injects the `IBookAppService` in its constructor and calls the `CreateAsync` method in the `OnPostAsync` handler. * This class simply injects the `IBookAppService` in its constructor and calls the `CreateAsync` method in the `OnPostAsync` handler.
@ -63,7 +63,7 @@ Open the `CreateModal.cshtml` file and paste the code below:
````html ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePageBase @inherits Acme.BookStore.Web.Pages.BookStorePage
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model Acme.BookStore.Web.Pages.Books.CreateModalModel @model Acme.BookStore.Web.Pages.Books.CreateModalModel
@{ @{
@ -145,7 +145,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Acme.BookStore.Web.Pages.Books namespace Acme.BookStore.Web.Pages.Books
{ {
public class EditModalModel : BookStorePageModelBase public class EditModalModel : BookStorePageModel
{ {
[HiddenInput] [HiddenInput]
[BindProperty(SupportsGet = true)] [BindProperty(SupportsGet = true)]
@ -207,7 +207,7 @@ Replace `EditModal.cshtml` content with the following content:
````html ````html
@page @page
@inherits Acme.BookStore.Web.Pages.BookStorePageBase @inherits Acme.BookStore.Web.Pages.BookStorePage
@using Acme.BookStore.Web.Pages.Books @using Acme.BookStore.Web.Pages.Books
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@model EditModalModel @model EditModalModel
@ -313,10 +313,12 @@ $(function () {
```` ````
* Used `abp.localization.getResource('BookStore')` to be able to use the same localization texts defined on the server side. * Used `abp.localization.getResource('BookStore')` to be able to use the same localization texts defined on the server side.
* Added a new `ModalManager` named `createModal` to open the create modal dialog.
* Added a new `ModalManager` named `editModal` to open the edit modal dialog. * Added a new `ModalManager` named `editModal` to open the edit modal dialog.
* Added a new column at the beginning of the `columnDefs` section. This column is used for the "Actions" dropdown button. * Added a new column at the beginning of the `columnDefs` section. This column is used for the "Actions" dropdown button.
* "New Book" action simply calls `createModal.open` to open the create dialog.
* "Edit" action simply calls `editModal.open` to open the edit dialog. * "Edit" action simply calls `editModal.open` to open the edit dialog.
`
You can run the application and edit any book by selecting the edit action. You can run the application and edit any book by selecting the edit action.
### Deleting an Existing Book ### Deleting an Existing Book
@ -355,6 +357,12 @@ $(function () {
var editModal = new abp.ModalManager(abp.appPath + 'Books/EditModal'); var editModal = new abp.ModalManager(abp.appPath + 'Books/EditModal');
var dataTable = $('#BooksTable').DataTable(abp.libs.datatables.normalizeConfiguration({ var dataTable = $('#BooksTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
autoWidth: false,
scrollCollapse: true,
order: [[1, "asc"]], order: [[1, "asc"]],
ajax: abp.libs.datatables.createAjax(acme.bookStore.book.getList), ajax: abp.libs.datatables.createAjax(acme.bookStore.book.getList),
columnDefs: [ columnDefs: [

Loading…
Cancel
Save