using FastEndpoints; using FrameworkBLL.UOM; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.UOM { public class DeleteUOM : BaseEndpoint> { public readonly IUOMBLL _UOMBLL; public DeleteUOM(IUOMBLL IUOMBLL) { _UOMBLL = IUOMBLL; } public override void Configure() { Delete("/UOM/DeleteUOM"); AllowAnonymous(); } public record DeleteUOMParameters( [property: FromHeader] string Login, [property: QueryParam] int UOMId ); protected override async Task> ExecuteAsync(DeleteUOMParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _UOMBLL.DeleteUOM(req.UOMId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }