Improve HtmlText module performance

This commit is contained in:
Shaun Walker
2019-08-16 09:49:26 -04:00
parent 9cda80f7e9
commit 0c57813bf8
9 changed files with 128 additions and 38 deletions

View File

@ -27,13 +27,9 @@ namespace Oqtane.Client.Modules.HtmlText.Services
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "HtmlText"); }
}
public async Task<List<HtmlTextInfo>> GetHtmlTextAsync(int ModuleId)
public async Task<HtmlTextInfo> GetHtmlTextAsync(int ModuleId)
{
List<HtmlTextInfo> htmltext = await http.GetJsonAsync<List<HtmlTextInfo>>(apiurl);
htmltext = htmltext
.Where(item => item.ModuleId == ModuleId)
.ToList();
return htmltext;
return await http.GetJsonAsync<HtmlTextInfo>(apiurl + "/" + ModuleId.ToString());
}
public async Task AddHtmlTextAsync(HtmlTextInfo htmltext)

View File

@ -6,7 +6,7 @@ namespace Oqtane.Client.Modules.HtmlText.Services
{
public interface IHtmlTextService
{
Task<List<HtmlTextInfo>> GetHtmlTextAsync(int ModuleId);
Task<HtmlTextInfo> GetHtmlTextAsync(int ModuleId);
Task AddHtmlTextAsync(HtmlTextInfo htmltext);