示例#1
0
        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);
        }
示例#2
0
 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);
     }
 }