using FastEndpoints; using FrameworkBLL.EntityMember; using FrameworkDAL.DTO.Entity; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.EntityMember { public class SaveEntityMember : BaseEndpoint> { private readonly IEntityMemberBLL _EntityMemberBLL; public SaveEntityMember(IEntityMemberBLL IEntityMemberBLL) { _EntityMemberBLL = IEntityMemberBLL; } public override void Configure() { Post("/EntityMember/SaveEntityMember"); AllowAnonymous(); } public record SaveEntityMemberParameters( [property: FromHeader] string Login, [property: FromBody] EntityMemberDTO EntityMemberDTO ); protected override async Task> ExecuteAsync(SaveEntityMemberParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _EntityMemberBLL.SaveEntityMember(req.EntityMemberDTO, 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); } } } }