diff --git a/docs/en/Tutorials/Part-10.md b/docs/en/Tutorials/Part-10.md index d72505b309..9f1f274d17 100644 --- a/docs/en/Tutorials/Part-10.md +++ b/docs/en/Tutorials/Part-10.md @@ -1126,6 +1126,21 @@ protected override async Task OnInitializedAsync() * It is essential to call the `base.OnInitializedAsync()` since `AbpCrudPageBase` has some initialization code to be executed. +Override the `OpenCreateModalAsync` method and adding the following code: + +````csharp +protected override async Task OpenCreateModalAsync() + { + if (!authorList.Any()) + { + throw new UserFriendlyException(message: L["AnAuthorIsRequiredForCreatingBook"]); + } + + await base.OpenCreateModalAsync(); + NewEntity.AuthorId = authorList.First().Id; + } +```` + The final `@code` block should be the following: ````csharp @@ -1147,6 +1162,17 @@ The final `@code` block should be the following: await base.OnInitializedAsync(); authorList = (await AppService.GetAuthorLookupAsync()).Items; } + + protected override async Task OpenCreateModalAsync() + { + if (!authorList.Any()) + { + throw new UserFriendlyException(message: L["AnAuthorIsRequiredForCreatingBook"]); + } + + await base.OpenCreateModalAsync(); + NewEntity.AuthorId = authorList.First().Id; + } } ```` @@ -1156,7 +1182,6 @@ Finally, add the following `Field` definition into the `ModalBody` of the *Creat @L["Author"]