using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.NDTCertificate; using MMDAL.DTO.NDTCertificate; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.NDTCertificate { public class SaveNDTCertificate : BaseEndpoint> { private readonly INDTCertificateBLL _NDTCertificateBLL; public SaveNDTCertificate(INDTCertificateBLL NDTCertificateBLL) { _NDTCertificateBLL = NDTCertificateBLL; } public override void Configure() { Post("/NDTCertificate/SaveNDTCertificate"); AllowAnonymous(); } public record SaveNDTCertificateParameters( [property: FromHeader] string Login, [property: FromBody] NDTCertificateDTO NDTCertificateDTO ); protected override async Task> ExecuteAsync(SaveNDTCertificateParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _NDTCertificateBLL.SaveNDTCertificate(req.NDTCertificateDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }