using FastEndpoints; using FrameworkBLL.WebForm; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.WebForm { public class DeleteWebForm : BaseEndpoint> { private readonly IWebFormBLL _WebFormBLL; public DeleteWebForm(IWebFormBLL IWebFormBLL) { _WebFormBLL = IWebFormBLL; } public override void Configure() { Delete("/WebForm/DeleteWebForm"); AllowAnonymous(); } public record DeleteWebFormParameters( [property: FromHeader] string Login, [property: QueryParam] int WebFormId ); protected override async Task> ExecuteAsync(DeleteWebFormParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _WebFormBLL.DeleteWebForm(req.WebFormId, 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); } } } }