HtmlText null exception fix

HtmlText Mode switch fix
Control panel fix

(cherry picked from commit b7d2cd0600)
This commit is contained in:
Pavel Vesely
2020-03-05 22:12:01 +01:00
parent 2c51c71527
commit ff18059b06
4 changed files with 22 additions and 8 deletions

View File

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Http;
using Oqtane.Infrastructure;
using Oqtane.Shared;
using System;
using System.Collections.Generic;
namespace Oqtane.Modules.HtmlText.Controllers
{
@ -29,22 +30,24 @@ namespace Oqtane.Modules.HtmlText.Controllers
// GET api/<controller>/5
[HttpGet("{id}")]
[Authorize(Policy = "ViewModule")]
public HtmlTextInfo Get(int id)
public List<HtmlTextInfo> Get(int id)
{
var list = new List<HtmlTextInfo>();
try
{
HtmlTextInfo HtmlText = null;
if (_entityId == id)
{
HtmlText = _htmlText.GetHtmlText(id);
list.Add(HtmlText);
}
return HtmlText;
}
catch (Exception ex)
{
_logger.Log(LogLevel.Error, this, LogFunction.Read, ex, "Get Error {Error}", ex.Message);
throw;
}
return list;
}
// POST api/<controller>