using FastEndpoints; using FMBLL.PartyBranchLocation; using FMDAL.DTO.PartyBranchLocation; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FMSL.EndPoints.PartyBranchLocation { public class SavePartyBranchLocation : BaseEndpoint> { private readonly IPartyBranchLocationBLL _PartyBranchLocationBLL; public SavePartyBranchLocation(IPartyBranchLocationBLL PartyBranchLocationBLL) { _PartyBranchLocationBLL = PartyBranchLocationBLL; } public override void Configure() { Post("/PartyBranchLocation/SavePartyBranchLocation"); AllowAnonymous(); } public record SavePartyBranchLocationParameters( [property: FromHeader] string Login, [property: FromBody] PartyBranchLocationDTO PartyBranchLocationDTO ); protected override async Task> ExecuteAsync(SavePartyBranchLocationParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _PartyBranchLocationBLL.SavePartyBranchLocation(req.PartyBranchLocationDTO, 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); } } } }