Well, I think I adapted it fine, but I am still not able to access it. Is there somewhere I need to register it?
Here is the base code:
namespace QuitLogix.Controllers
{
[ApiController]
//[Route("api/[controller]")]
[Route("api/ProsAndCons")]
public class ProsAndConsController : ControllerBase
{
private readonly IPageBuilderDataContextRetriever _pageBuilderDataContextRetriever;
private readonly IPageRetriever _pageRetriever;
private readonly ISiteService _siteService;
private readonly IFileService _fileService;
private readonly IOptionsMonitor<XperienceOptions> _optionsMonitor;
private readonly ProsConsDataRepository _prosConsDataRepository;
public enum ItemType
{
Pro,
Con
}
public class ProsAndConsModel
{
public List<ProsAndCons> Pros { get; set; }
public List<ProsAndCons> Cons { get; set; }
public HttpStatusCode StatusCode { get; set; }
}
public ProsAndConsController(
IPageBuilderDataContextRetriever pageBuilderDataContextRetriever,
IPageRetriever pageRetriever,
ISiteService siteService,
IFileService fileService,
IOptionsMonitor<XperienceOptions> optionsMonitor,
ProsConsDataRepository prosConsDataRepository)
{
_pageBuilderDataContextRetriever = pageBuilderDataContextRetriever ?? throw new ArgumentNullException(nameof(pageBuilderDataContextRetriever));
_pageRetriever = pageRetriever ?? throw new ArgumentNullException(nameof(pageRetriever));
_siteService = siteService ?? throw new ArgumentNullException(nameof(siteService));
_fileService = fileService ?? throw new ArgumentNullException(nameof(fileService));
_optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor));
_prosConsDataRepository = prosConsDataRepository ?? throw new ArgumentNullException(nameof(prosConsDataRepository));
}
[HttpGet]
[ValidateAntiForgeryToken]
public async Task<ProsAndConsModel> Get(string data)
{
var result = new ProsAndConsModel()
{
Pros = new List<ProsAndCons>(),
Cons = new List<ProsAndCons>()
};
try
{...
I am just not sure where I am going wrong with this.