46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using DomainResults.Mvc;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using WeatherForecast.Models;
|
|
using WeatherForecast.Models.Abstractions;
|
|
using WeatherForecast.Models.Pages;
|
|
using WeatherForecast.Models.PageSections;
|
|
using WeatherForecast.Models.Responses;
|
|
using WeatherForecast.Services;
|
|
|
|
namespace WeatherForecast.Controllers;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[ApiController]
|
|
[AllowAnonymous]
|
|
[Route("api/[controller]")]
|
|
public class ContentController : ControllerBase {
|
|
|
|
private readonly ILogger<ContentController> _logger;
|
|
private readonly IContentService _contentService;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="logger"></param>
|
|
public ContentController(
|
|
ILogger<ContentController> logger,
|
|
IContentService contentService
|
|
) {
|
|
_logger = logger;
|
|
_contentService = contentService;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("{siteId}")]
|
|
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale) {
|
|
var result = _contentService.GetContent(siteId, locale ?? "en-US") ;
|
|
return result.ToActionResult();
|
|
}
|
|
}
|