ReadByName in EmailTemplate Repositroy und Dienst hinzugefügt.

This commit is contained in:
Developer 02
2024-05-17 13:59:40 +02:00
parent 2e66129485
commit bc6972bcfb
6 changed files with 56 additions and 13 deletions

View File

@@ -1,7 +1,11 @@
using EnvelopeGenerator.Application.Contracts;
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
{
@@ -9,7 +13,23 @@ namespace EnvelopeGenerator.Web.Controllers.Test
{
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();
}
}