using FastEndpoints; using FMBLL.AssetType; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FMSL.EndPoints.AssetType { public class DeleteAssetType : BaseEndpoint> { public readonly IAssetTypeBLL _AssetTypeBLL; public DeleteAssetType(IAssetTypeBLL IAssetTypeBLL) { _AssetTypeBLL = IAssetTypeBLL; } public override void Configure() { Delete("/AssetType/DeleteAssetType"); AllowAnonymous(); } public record DeleteAssetTypeParameters( [property: FromHeader] string Login, [property: QueryParam] int AssetTypeId ); protected override async Task> ExecuteAsync(DeleteAssetTypeParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _AssetTypeBLL.DeleteAssetType(req.AssetTypeId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.USER_LEVEL, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.USER_LEVEL, LoginDTO, ex.Message, 500); } } } }