OneConversorTemplate/UpperFirstLetter/Controllers/ModuleController.cs
2025-06-08 12:44:02 -03:00

47 lines
1.6 KiB
C#

using Microsoft.AspNetCore.Mvc;
using SentenceConverterModule.Services.Contracts;
namespace SentenceConverterModule.Controllers
{
[Route("modules")]
public class ModuleController : Controller
{
private readonly ISentenceConverterService _converterService;
public ModuleController(ISentenceConverterService converterService)
{
_converterService = converterService;
}
[HttpGet("sentence-converter")]
public async Task<IActionResult> SentenceConverter([FromQuery] string language = "pt")
{
var config = _converterService.GetConfiguration(language);
ViewBag.Config = config;
ViewBag.Language = language;
return PartialView("_SentenceConverterModule");
}
[HttpGet("footer-message")]
public IActionResult FooterMessage()
{
return Content(@"
<div class='alert alert-info text-center'>
<h6><i class='fas fa-magic me-2'></i>Módulo Carregado!</h6>
<p class='mb-2'>Este conteúdo veio de um projeto separado!</p>
<button class='btn btn-sm btn-primary' onclick='loadSentenceConverter()'>
Carregar Conversor Completo
</button>
</div>
<script>
function loadSentenceConverter() {
window.ModuleSystem.loadModule('sentence-converter', 'footer-module');
}
</script>
", "text/html");
}
}
}