Browse Source

Update Blazor server web tutorials document

pull/22958/head
liangshiwei 9 months ago
parent
commit
d779f13bad
  1. 49
      docs/en/tutorials/book-store/part-09.md

49
docs/en/tutorials/book-store/part-09.md

@ -1158,14 +1158,21 @@ public partial class Authors
private async Task DeleteAuthorAsync(AuthorDto author) private async Task DeleteAuthorAsync(AuthorDto author)
{ {
var confirmMessage = L["AuthorDeletionConfirmationMessage", author.Name]; try
if (!await Message.Confirm(confirmMessage))
{ {
return; var confirmMessage = L["AuthorDeletionConfirmationMessage", author.Name];
} if (!await Message.Confirm(confirmMessage))
{
return;
}
await AuthorAppService.DeleteAsync(author.Id); await AuthorAppService.DeleteAsync(author.Id);
await GetAuthorsAsync(); await GetAuthorsAsync();
}
catch(Exception ex)
{
await HandleErrorAsync(ex);
}
} }
private void CloseEditAuthorModal() private void CloseEditAuthorModal()
@ -1175,21 +1182,35 @@ public partial class Authors
private async Task CreateAuthorAsync() private async Task CreateAuthorAsync()
{ {
if (await CreateValidationsRef.ValidateAll()) try
{ {
await AuthorAppService.CreateAsync(NewAuthor); if (await CreateValidationsRef.ValidateAll())
await GetAuthorsAsync(); {
CreateAuthorModal.Hide(); await AuthorAppService.CreateAsync(NewAuthor);
await GetAuthorsAsync();
CreateAuthorModal.Hide();
}
}
catch(Exception ex)
{
await HandleErrorAsync(ex);
} }
} }
private async Task UpdateAuthorAsync() private async Task UpdateAuthorAsync()
{ {
if (await EditValidationsRef.ValidateAll()) try
{ {
await AuthorAppService.UpdateAsync(EditingAuthorId, EditingAuthor); if (await EditValidationsRef.ValidateAll())
await GetAuthorsAsync(); {
EditAuthorModal.Hide(); await AuthorAppService.UpdateAsync(EditingAuthorId, EditingAuthor);
await GetAuthorsAsync();
EditAuthorModal.Hide();
}
}
catch(Exception ex)
{
await HandleErrorAsync(ex);
} }
} }
} }

Loading…
Cancel
Save