using FastEndpoints; using FrameworkBLL.WebForm; using FrameworkDAL.DTO.Form; 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 SaveWebForm : BaseEndpoint> { private readonly IWebFormBLL _WebFormBLL; public SaveWebForm(IWebFormBLL WebFormBLL) { _WebFormBLL = WebFormBLL; } public override void Configure() { Post("/WebForm/SaveWebForm"); AllowAnonymous(); } public record SaveWebFormParameters( [property: FromHeader] string Login, [property: FromBody] WebFormDTO WebFormDTO ); protected override async Task> ExecuteAsync(SaveWebFormParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _WebFormBLL.SaveWebForm(req.WebFormDTO, 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); } } } }