Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 lines (37 sloc)
1.34 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using Microsoft.AspNetCore.Mvc; | |
using sampleApi.Utils.EntityLinking; | |
namespace sampleApi.Controllers | |
{ | |
[ApiController] | |
[Route("[controller]")] | |
public class EntityLinkedController : ControllerBase | |
{ | |
[HttpGet] | |
public IActionResult GetWithABResource() | |
{ | |
List<Entity> entities = new List<Entity>(); | |
List<ILinkedResource> resources = new List<ILinkedResource>(); | |
resources.Add(new SampleRelatedResourceController()); | |
IResourceVisitor visitor = new LogicABResourceVisitor(); | |
foreach (ILinkedResource resource in resources) | |
{ | |
entities.AddRange(resource.Accept(visitor)); | |
} | |
return Ok(entities); | |
} | |
[HttpGet] | |
public IActionResult GetWithCDResource() | |
{ | |
List<Entity> entities = new List<Entity>(); | |
List<ILinkedResource> resources = new List<ILinkedResource>(); | |
resources.Add(new SampleRelatedResourceController()); | |
IResourceVisitor visitor = new LogicCDResourceVisitor(); | |
foreach (ILinkedResource resource in resources) | |
{ | |
entities.AddRange(resource.Accept(visitor)); | |
} | |
return Ok(entities); | |
} | |
} | |
} |