Added support for MySQL and ProgreSQL and AddSite/Tenant
This commit is contained in:
@ -25,12 +25,12 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
// GET api/<controller>/5
|
||||
[HttpGet("{id}")]
|
||||
[Authorize(Policy = PolicyNames.ViewModule)]
|
||||
public List<HtmlTextInfo> Get(int id)
|
||||
public List<Models.HtmlText> Get(int id)
|
||||
{
|
||||
var list = new List<HtmlTextInfo>();
|
||||
var list = new List<Models.HtmlText>();
|
||||
try
|
||||
{
|
||||
HtmlTextInfo htmlText = null;
|
||||
Models.HtmlText htmlText = null;
|
||||
if (_entityId == id)
|
||||
{
|
||||
htmlText = _htmlText.GetHtmlText(id);
|
||||
@ -48,7 +48,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
[Authorize(Policy = PolicyNames.EditModule)]
|
||||
public HtmlTextInfo Post([FromBody] HtmlTextInfo htmlText)
|
||||
public Models.HtmlText Post([FromBody] Models.HtmlText htmlText)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -69,7 +69,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut("{id}")]
|
||||
[Authorize(Policy = PolicyNames.EditModule)]
|
||||
public HtmlTextInfo Put(int id, [FromBody] HtmlTextInfo htmlText)
|
||||
public Models.HtmlText Put(int id, [FromBody] Models.HtmlText htmlText)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ namespace Oqtane.Modules.HtmlText.Manager
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlText = new HtmlTextInfo();
|
||||
htmlText = new Models.HtmlText();
|
||||
htmlText.ModuleId = module.ModuleId;
|
||||
htmlText.Content = content;
|
||||
_htmlText.AddHtmlText(htmlText);
|
||||
|
@ -4,7 +4,6 @@ using Microsoft.EntityFrameworkCore.Migrations.Operations.Builders;
|
||||
using Oqtane.Interfaces;
|
||||
using Oqtane.Migrations;
|
||||
using Oqtane.Migrations.EntityBuilders;
|
||||
using Oqtane.Migrations.Extensions;
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
@ -26,9 +25,9 @@ namespace Oqtane.Modules.HtmlText.Migrations.EntityBuilders
|
||||
|
||||
protected override HtmlTextEntityBuilder BuildTable(ColumnsBuilder table)
|
||||
{
|
||||
HtmlTextId = ActiveDatabase.AddAutoIncrementColumn(table,"HtmlTextId");
|
||||
ModuleId = table.AddIntegerColumn("ModuleId");
|
||||
Content = table.AddMaxStringColumn("Content");
|
||||
HtmlTextId = AddAutoIncrementColumn(table,"HtmlTextId");
|
||||
ModuleId = AddIntegerColumn(table,"ModuleId");
|
||||
Content = AddMaxStringColumn(table,"Content");
|
||||
|
||||
AddAuditableColumns(table);
|
||||
|
||||
|
@ -16,6 +16,6 @@ namespace Oqtane.Modules.HtmlText.Repository
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<HtmlTextInfo> HtmlText { get; set; }
|
||||
public virtual DbSet<Models.HtmlText> HtmlText { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -13,20 +13,20 @@ namespace Oqtane.Modules.HtmlText.Repository
|
||||
_db = context;
|
||||
}
|
||||
|
||||
public HtmlTextInfo GetHtmlText(int moduleId)
|
||||
public Models.HtmlText GetHtmlText(int moduleId)
|
||||
{
|
||||
return _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
|
||||
}
|
||||
|
||||
|
||||
public HtmlTextInfo AddHtmlText(HtmlTextInfo htmlText)
|
||||
public Models.HtmlText AddHtmlText(Models.HtmlText htmlText)
|
||||
{
|
||||
_db.HtmlText.Add(htmlText);
|
||||
_db.SaveChanges();
|
||||
return htmlText;
|
||||
}
|
||||
|
||||
public HtmlTextInfo UpdateHtmlText(HtmlTextInfo htmlText)
|
||||
public Models.HtmlText UpdateHtmlText(Models.HtmlText htmlText)
|
||||
{
|
||||
_db.Entry(htmlText).State = EntityState.Modified;
|
||||
_db.SaveChanges();
|
||||
@ -35,7 +35,7 @@ namespace Oqtane.Modules.HtmlText.Repository
|
||||
|
||||
public void DeleteHtmlText(int moduleId)
|
||||
{
|
||||
HtmlTextInfo htmlText = _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
|
||||
Models.HtmlText htmlText = _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
|
||||
if (htmlText != null) _db.HtmlText.Remove(htmlText);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
|
@ -4,9 +4,9 @@ namespace Oqtane.Modules.HtmlText.Repository
|
||||
{
|
||||
public interface IHtmlTextRepository
|
||||
{
|
||||
HtmlTextInfo GetHtmlText(int moduleId);
|
||||
HtmlTextInfo AddHtmlText(HtmlTextInfo htmlText);
|
||||
HtmlTextInfo UpdateHtmlText(HtmlTextInfo htmlText);
|
||||
Models.HtmlText GetHtmlText(int moduleId);
|
||||
Models.HtmlText AddHtmlText(Models.HtmlText htmlText);
|
||||
Models.HtmlText UpdateHtmlText(Models.HtmlText htmlText);
|
||||
void DeleteHtmlText(int moduleId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user