using FrameworkBLL.BIZTransactionSubClass; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; using System.Threading; using System.Threading.Tasks; namespace FrameworkSL.Endpoints.BIZTransactionSubClass { public class DeleteBIZTransactionSubClass : BaseEndpoint> { private readonly IBIZTransactionSubClassBLL _bizTransactionSubClassBLL; public DeleteBIZTransactionSubClass(IBIZTransactionSubClassBLL bizTransactionSubClassBLL) { _bizTransactionSubClassBLL = bizTransactionSubClassBLL; } public override void Configure() { Delete("/BIZTransactionSubClass/DeleteBIZTransactionSubClass"); AllowAnonymous(); } public record DeleteBIZTransactionSubClassParameters( [property: FromHeader] string Login, [property: QueryParam] int BIZTransactionSubClassId ); protected override async Task> ExecuteAsync(DeleteBIZTransactionSubClassParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _bizTransactionSubClassBLL.DeleteBIZTransactionSubClass(req.BIZTransactionSubClassId, 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 ); } } } }