using CMSBLL.ContentType; using FastEndpoints; 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 CMSSL.Endpoints.ContentType { public class DeleteContentType : BaseEndpoint> { private readonly IContentTypeBLL _ContentTypeBLL; public DeleteContentType(IContentTypeBLL IContentTypeBLL) { _ContentTypeBLL = IContentTypeBLL; } public override void Configure() { Delete("/ContentType/DeleteContentType"); AllowAnonymous(); } public record DeleteContentTypeParameters( [property: FromHeader] string Login, [property: QueryParam] int ContentTypeId ); protected override async Task> ExecuteAsync(DeleteContentTypeParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _ContentTypeBLL.DeleteContentType(req.ContentTypeId, 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); } } } }