using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Color; namespace MMSL.EndPoints.Color { public class DeleteColor : BaseEndpoint> { public readonly IColorBLL _ColorBLL; public DeleteColor(IColorBLL IColorBLL) { _ColorBLL = IColorBLL; } public override void Configure() { Delete("/Color/DeleteColor"); AllowAnonymous(); } public record DeleteColorParameters( [property: FromHeader] string Login, [property: QueryParam] int ColorId ); protected override async Task> ExecuteAsync(DeleteColorParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _ColorBLL.DeleteColor(req.ColorId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, GB5Shared.GB5Constant.Constant.CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, GB5Shared.GB5Constant.Constant.CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }