private async Task UpdateAsync(AssetTypeDto assetType) { var request = new UpdateAssetTypeDto { Id = assetType.Id, Name = assetType.Name, Description = assetType.Description }; var response = await _assetTypeManager.UpdateAsync(request); if (response.Succeeded) { await GetAllAssetTypes(); AssetTypeDialogVisible = false; } else { foreach (var message in response.Messages) { await _message.Error(message); } } }
private async Task SaveAsync(AssetTypeDto assetType) { if (assetType.Id == 0) { await CreateAsync(assetType); } else { await UpdateAsync(assetType); } }
private async Task ShowDeleteConfirm(AssetTypeDto assetType) { var content = $"Are you sure to delete Asset Type '{assetType.Name}' ?"; var title = "Delete confirmation"; var confirmResult = await _confirmService.Show(content, title, ConfirmButtons.YesNo); if (confirmResult == ConfirmResult.Yes) { await Delete(assetType); } }
private void Edit(int id) { var existedAssetType = AssetTypeResponses.FirstOrDefault(x => x.Id.Equals(id)); AssetType = new AssetTypeDto() { Id = id, Name = existedAssetType.Name, Description = existedAssetType.Description }; AssetTypeDialogTitle = "Update Asset Type"; AssetTypeDialogVisible = true; }
private async Task Delete(AssetTypeDto assetType) { var response = await _assetTypeManager.DeleteAsync(assetType.Id); if (response.Succeeded) { await GetAllAssetTypes(); } else { foreach (var message in response.Messages) { await _message.Error(message); } } }
private void HandleCreate() { AssetType = new AssetTypeDto(); AssetTypeDialogTitle = "Create Asset Type"; AssetTypeDialogVisible = true; }