using DigitalData.Core.DTO; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.DTOs; using EnvelopeGenerator.Domain.Entities; using Microsoft.AspNetCore.Mvc; using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Web.Controllers.Test { public class TestEmailTemplateController : TestControllerBase { public TestEmailTemplateController(ILogger logger, IEmailTemplateService service) : base(logger, service) { } [HttpGet] public virtual async Task GetAll([FromQuery] string? tempType = null) { return tempType is null ? await base.GetAll() : await _service.ReadByNameAsync((EmailTemplateType)Enum.Parse(typeof(EmailTemplateType), tempType)).ThenAsync( Success: Ok, Fail: IActionResult (messages, notices) => { _logger.LogNotice(notices); return NotFound(messages); }); } [NonAction] public override Task GetAll() => base.GetAll(); } }