using FastEndpoints; using FrameworkBLL.ParameterSet; using FrameworkDAL.DTO.Parameter; using FrameworkDAL.DTO.SMS; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.ParameterSet { public class SaveParameterSet : BaseEndpoint> { private readonly IParameterSetBLL _ParameterSetBLL; public SaveParameterSet(IParameterSetBLL ParameterSetBLL) { _ParameterSetBLL = ParameterSetBLL; } public override void Configure() { Post("/ParameterSet/SaveParameterSet"); AllowAnonymous(); } public record SaveParameterSetParameters( [property: FromBody] ParameterSetDTO ParameterSetDTO, [property: FromHeader] string Login ); protected override async Task> ExecuteAsync(SaveParameterSetParameters parameters, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _ParameterSetBLL.SaveParameterSet(parameters.ParameterSetDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NotRequired, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError( ex, CacheKeyLevel.NotRequired, LoginDTO, ex.Message, 500); } } } }