public ActionResult TreeLoadChildren(int?id = null, string searchName = "") { var codes = _codeService.GetAllCodesByParentId(id) .Select(x => new { id = x.Id, Name = x.Name, hasChildren = _codeService.GetAllCodesByParentId(x.Id).Count > 0, imageUrl = Url.Content("~/Content/images/ico-cube.png") }); return(Json(codes)); }