using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.TDSContact; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.TDSContact { public class DeleteTDSContact : BaseEndpoint> { public readonly ITDSContactBLL _TDSContactBLL; public DeleteTDSContact(ITDSContactBLL ITDSContactBLL) { _TDSContactBLL = ITDSContactBLL; } public override void Configure() { Delete("/TDSContact/DeleteTDSContact"); AllowAnonymous(); } public record DeleteTDSContactParameters( [property: FromHeader] string Login, [property: QueryParam] int TDSContactId ); protected override async Task> ExecuteAsync(DeleteTDSContactParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _TDSContactBLL.DeleteTDSContact(req.TDSContactId, 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); } } } }