Fix naming conventions for private fields
This commit is contained in:
@ -12,17 +12,17 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
[Route("{site}/api/[controller]")]
|
||||
public class HtmlTextController : Controller
|
||||
{
|
||||
private readonly IHtmlTextRepository htmltext;
|
||||
private readonly ILogManager logger;
|
||||
private int EntityId = -1; // passed as a querystring parameter for authorization and used for validation
|
||||
private readonly IHtmlTextRepository _htmlText;
|
||||
private readonly ILogManager _logger;
|
||||
private int _entityId = -1; // passed as a querystring parameter for authorization and used for validation
|
||||
|
||||
public HtmlTextController(IHtmlTextRepository HtmlText, ILogManager logger, IHttpContextAccessor HttpContextAccessor)
|
||||
{
|
||||
htmltext = HtmlText;
|
||||
this.logger = logger;
|
||||
_htmlText = HtmlText;
|
||||
this._logger = logger;
|
||||
if (HttpContextAccessor.HttpContext.Request.Query.ContainsKey("entityid"))
|
||||
{
|
||||
EntityId = int.Parse(HttpContextAccessor.HttpContext.Request.Query["entityid"]);
|
||||
_entityId = int.Parse(HttpContextAccessor.HttpContext.Request.Query["entityid"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,15 +34,15 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
try
|
||||
{
|
||||
HtmlTextInfo HtmlText = null;
|
||||
if (EntityId == id)
|
||||
if (_entityId == id)
|
||||
{
|
||||
HtmlText = htmltext.GetHtmlText(id);
|
||||
HtmlText = _htmlText.GetHtmlText(id);
|
||||
}
|
||||
return HtmlText;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Log(LogLevel.Error, this, LogFunction.Read, ex, "Get Error {Error}", ex.Message);
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Read, ex, "Get Error {Error}", ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -54,16 +54,16 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid && HtmlText.ModuleId == EntityId)
|
||||
if (ModelState.IsValid && HtmlText.ModuleId == _entityId)
|
||||
{
|
||||
HtmlText = htmltext.AddHtmlText(HtmlText);
|
||||
logger.Log(LogLevel.Information, this, LogFunction.Create, "Html/Text Added {HtmlText}", HtmlText);
|
||||
HtmlText = _htmlText.AddHtmlText(HtmlText);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Html/Text Added {HtmlText}", HtmlText);
|
||||
}
|
||||
return HtmlText;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Log(LogLevel.Error, this, LogFunction.Create, ex, "Post Error {Error}", ex.Message);
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Create, ex, "Post Error {Error}", ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -75,16 +75,16 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid && HtmlText.ModuleId == EntityId)
|
||||
if (ModelState.IsValid && HtmlText.ModuleId == _entityId)
|
||||
{
|
||||
HtmlText = htmltext.UpdateHtmlText(HtmlText);
|
||||
logger.Log(LogLevel.Information, this, LogFunction.Update, "Html/Text Updated {HtmlText}", HtmlText);
|
||||
HtmlText = _htmlText.UpdateHtmlText(HtmlText);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Html/Text Updated {HtmlText}", HtmlText);
|
||||
}
|
||||
return HtmlText;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Log(LogLevel.Error, this, LogFunction.Update, ex, "Put Error {Error}", ex.Message);
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Update, ex, "Put Error {Error}", ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -96,15 +96,15 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (id == EntityId)
|
||||
if (id == _entityId)
|
||||
{
|
||||
htmltext.DeleteHtmlText(id);
|
||||
logger.Log(LogLevel.Information, this, LogFunction.Delete, "Html/Text Deleted {HtmlTextId}", id);
|
||||
_htmlText.DeleteHtmlText(id);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Html/Text Deleted {HtmlTextId}", id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Log(LogLevel.Error, this, LogFunction.Delete, ex, "Delete Error {Error}", ex.Message);
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Delete, ex, "Delete Error {Error}", ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user