Improve HtmlText module performance
This commit is contained in:
@ -15,13 +15,6 @@ namespace Oqtane.Server.Modules.HtmlText.Controllers
|
||||
htmltext = HtmlText;
|
||||
}
|
||||
|
||||
// GET: api/<controller>
|
||||
[HttpGet]
|
||||
public IEnumerable<HtmlTextInfo> Get()
|
||||
{
|
||||
return htmltext.GetHtmlText();
|
||||
}
|
||||
|
||||
// GET api/<controller>/5
|
||||
[HttpGet("{id}")]
|
||||
public HtmlTextInfo Get(int id)
|
||||
|
@ -15,11 +15,11 @@ namespace Oqtane.Server.Modules.HtmlText.Repository
|
||||
db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<HtmlTextInfo> GetHtmlText()
|
||||
public HtmlTextInfo GetHtmlText(int ModuleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.HtmlText.ToList();
|
||||
return db.HtmlText.Where(item => item.ModuleId == ModuleId).FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -27,6 +27,7 @@ namespace Oqtane.Server.Modules.HtmlText.Repository
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HtmlTextInfo AddHtmlText(HtmlTextInfo HtmlText)
|
||||
{
|
||||
try
|
||||
@ -55,19 +56,6 @@ namespace Oqtane.Server.Modules.HtmlText.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public HtmlTextInfo GetHtmlText(int HtmlTextId)
|
||||
{
|
||||
try
|
||||
{
|
||||
HtmlTextInfo HtmlText = db.HtmlText.Find(HtmlTextId);
|
||||
return HtmlText;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteHtmlText(int HtmlTextId)
|
||||
{
|
||||
try
|
||||
|
@ -5,10 +5,9 @@ namespace Oqtane.Server.Modules.HtmlText.Repository
|
||||
{
|
||||
public interface IHtmlTextRepository
|
||||
{
|
||||
IEnumerable<HtmlTextInfo> GetHtmlText();
|
||||
HtmlTextInfo GetHtmlText(int ModuleId);
|
||||
HtmlTextInfo AddHtmlText(HtmlTextInfo HtmlText);
|
||||
HtmlTextInfo UpdateHtmlText(HtmlTextInfo HtmlText);
|
||||
HtmlTextInfo GetHtmlText(int HtmlTextIdId);
|
||||
void DeleteHtmlText(int HtmlTextId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user