You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
integrate with asp mvc core/blazor and show Brackets for leagues and sports (custom teams, golf, pickelball, soccer)
The nodes in C#
public class Node
{
public int Id { get; set; }
public string Name { get; set; }
public int? ParentId { get; set; }
public string Description { get; set; }
public bool IsExpanded { get; set; }
}
public class Connection
{
public int FromId { get; set; }
public int ToId { get; set; }
public string Label { get; set; }
}
public class OrgChartModel
{
public List<Node> Nodes { get; set; }
public List<Connection> Connections { get; set; }
}
Controller
[ApiController]
[Route("api/[controller]")]
public class OrgChartController : ControllerBase
{
private readonly OrgChartContext _context;
public OrgChartController(OrgChartContext context)
{
_context = context;
}
[HttpGet]
public async Task<ActionResult<OrgChartModel>> GetOrgChart()
{
var nodes = await _context.Nodes.ToListAsync();
var connections = await _context.Connections.ToListAsync();
var model = new OrgChartModel
{
Nodes = nodes,
Connections = connections
};
return model;
}
[HttpPost]
public async Task<ActionResult<Node>> AddNode(Node node)
{
_context.Nodes.Add(node);
await _context.SaveChangesAsync();
return node;
}
[HttpDelete("{id}")]
public async Task<ActionResult> DeleteNode(int id)
{
var node = await _context.Nodes.FindAsync(id);
if (node == null)
{
return NotFound();
}
_context.Nodes.Remove(node);
await _context.SaveChangesAsync();
return NoContent();
}
}
cshar p Razor View, how do I do all the options you had and do bracket layout?
integrate with asp mvc core/blazor and show Brackets for leagues and sports (custom teams, golf, pickelball, soccer)
The nodes in C#
Controller
cshar p Razor View, how do I do all the options you had and do bracket layout?
The text was updated successfully, but these errors were encountered: