using FastEndpoints; using FrameworkBLL.UserVsPortlet; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.UserVsPortlet { public class DeleteUserVsPortletWithUserIdandPageId : BaseEndpoint> { private readonly IUserVsPortletBLL _UserVsPortletBLL; public DeleteUserVsPortletWithUserIdandPageId(IUserVsPortletBLL IUserVsPortletBLL) { _UserVsPortletBLL = IUserVsPortletBLL; } public override void Configure() { Delete("/UserVsPortlet/DeleteUserVsPortletWithUserIdandPageId"); AllowAnonymous(); } public record DeleteUserVsPortletWithUserIdandPageIdParameters( [property: FromHeader] string Login, [property: QueryParam] int UserId, [property: QueryParam] int PageId ); protected override async Task> ExecuteAsync(DeleteUserVsPortletWithUserIdandPageIdParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _UserVsPortletBLL.DeleteUserVsPortletWithUserIdandPageId(req.UserId, req.PageId, 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); } } } }