24 lines
755 B
C#

using EnvelopeGenerator.Application.Contracts;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Web.Controllers.Test
{
[Route("api/[controller]")]
[ApiController]
public class TestMessagingController : ControllerBase
{
private readonly ISmsSender _service;
public TestMessagingController(ISmsSender service)
{
_service = service;
}
[HttpPost]
public async Task<IActionResult> SendAsync(string recipient, string message, bool staticResponse = true)
{
var res = await _service.SendSmsAsync(recipient: recipient, message: message);
return res is null? StatusCode(StatusCodes.Status500InternalServerError) : Ok(res);
}
}
}