public static OrgChartVm PrepareForJs(this OrganigramViewModel vm) { var ret = new OrgChartVm(); ret.Manager = vm.Manager.MapToOrgChargEmp(); ret.Employee = vm.Employee.MapToOrgChargEmp(); ret.Employees = vm.Employees.Select(x => x.MapToOrgChargEmp()).ToList(); return(ret); }
public static async Task DrawOrg(this IJSRuntime jsRuntime, OrganigramViewModel vm) { try { await jsRuntime.InvokeVoidAsync("canvasOrgChartJSInterop.DrawOrg", vm.PrepareForJs()); } catch (Exception ex) { throw new Exception($"Error while drawing the org chart: {ex.Message}", ex); } }