35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using DigitalData.Core.DTO;
|
|
using EnvelopeGenerator.Application.Contracts;
|
|
using EnvelopeGenerator.Application.DTOs;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
using EnvelopeGenerator.Infrastructure.Contracts;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Security.Cryptography;
|
|
using static EnvelopeGenerator.Common.Constants;
|
|
|
|
namespace EnvelopeGenerator.Web.Controllers.Test
|
|
{
|
|
public class TestEmailTemplateController : TestControllerBase<IEmailTemplateService, EmailTemplateDto, EmailTemplate, int>
|
|
{
|
|
public TestEmailTemplateController(ILogger<TestEmailTemplateController> logger, IEmailTemplateService service) : base(logger, service)
|
|
{
|
|
}
|
|
|
|
[HttpGet]
|
|
public virtual async Task<IActionResult> 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<IActionResult> GetAll() => base.GetAll();
|
|
}
|
|
} |