Replaced direct service dependency and base class inheritance with MediatR in TestEmailTemplateController. Updated the GetAll endpoint to use a MediatR query and removed obsolete code related to the previous service-based approach. This aligns the controller with CQRS/MediatR best practices.
22 lines
593 B
C#
22 lines
593 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using MediatR;
|
|
using EnvelopeGenerator.Application.EmailTemplates.Queries;
|
|
|
|
namespace EnvelopeGenerator.Web.Controllers.Test;
|
|
|
|
public class TestEmailTemplateController : ControllerBase
|
|
{
|
|
private readonly IMediator _mediator;
|
|
|
|
public TestEmailTemplateController(IMediator mediator)
|
|
{
|
|
_mediator = mediator;
|
|
}
|
|
|
|
[HttpGet]
|
|
public virtual async Task<IActionResult> GetAll([FromQuery] ReadEmailTemplateQuery query, CancellationToken cancel)
|
|
{
|
|
var res = await _mediator.Send(query, cancel);
|
|
return Ok(res);
|
|
}
|
|
} |