using AutoMapper; using DigitalData.Core.Application; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Infrastructure.Contracts; using EnvelopeGenerator.Application.DTOs.Receiver; using DigitalData.Core.DTO; namespace EnvelopeGenerator.Application.Services { public class ReceiverService : CRUDService, IReceiverService { public ReceiverService(IReceiverRepository repository, IMapper mapper) : base(repository, mapper) { } public async Task> ReadByAsync(string? emailAddress = null, string? signature = null) { var rcv = await _repository.ReadByAsync(emailAddress: emailAddress, signature: signature); if (rcv is null) return Result.Fail(); return Result.Success(_mapper.Map(rcv)); } public async Task DeleteByAsync(string? emailAddress = null, string? signature = null) { var rcv = await _repository.ReadByAsync(emailAddress: emailAddress, signature: signature); if (rcv is null) return Result.Fail(); return await _repository.DeleteAsync(rcv) ? Result.Success() : Result.Fail(); } } }