Deleting products
Deleting a product is pretty simple compared to the create or edit actions since, in this case, we don't need to build a form. First, add a new method to the IProductAppService
interface:
Task DeleteAsync(Guid id);
Then, implement it in the ProductAppService
class:
public async Task DeleteAsync(Guid id) { await _productRepository.DeleteAsync(id); }
We can now add a new action to the product data table. Open Index.cshtml.js
, and add the following definition just after the Edit action (in the rowAction.items
array):
{ text: l('Delete'), confirmMessage: function (data) { return l('ProductDeletionConfirmationMessage', data.record.name); ...