Server naming fixes and cleanup

Server is now completely cleaned up and without warnings
This commit is contained in:
Pavel Vesely
2020-03-15 09:38:37 +01:00
parent ab3f0853a7
commit 5b3feaf26f
92 changed files with 1223 additions and 1273 deletions

View File

@ -9,7 +9,7 @@ namespace Oqtane.Modules.HtmlText.Repository
{
public virtual DbSet<HtmlTextInfo> HtmlText { get; set; }
public HtmlTextContext(ITenantResolver TenantResolver, IHttpContextAccessor accessor) : base(TenantResolver, accessor)
public HtmlTextContext(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
{
// ContextBase handles multi-tenant database connections
}

View File

@ -13,59 +13,31 @@ namespace Oqtane.Modules.HtmlText.Repository
_db = context;
}
public HtmlTextInfo GetHtmlText(int ModuleId)
public HtmlTextInfo GetHtmlText(int moduleId)
{
try
{
return _db.HtmlText.Where(item => item.ModuleId == ModuleId).FirstOrDefault();
}
catch
{
throw;
}
return _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
}
public HtmlTextInfo AddHtmlText(HtmlTextInfo HtmlText)
public HtmlTextInfo AddHtmlText(HtmlTextInfo htmlText)
{
try
{
_db.HtmlText.Add(HtmlText);
_db.SaveChanges();
return HtmlText;
}
catch
{
throw;
}
_db.HtmlText.Add(htmlText);
_db.SaveChanges();
return htmlText;
}
public HtmlTextInfo UpdateHtmlText(HtmlTextInfo HtmlText)
public HtmlTextInfo UpdateHtmlText(HtmlTextInfo htmlText)
{
try
{
_db.Entry(HtmlText).State = EntityState.Modified;
_db.SaveChanges();
return HtmlText;
}
catch
{
throw;
}
_db.Entry(htmlText).State = EntityState.Modified;
_db.SaveChanges();
return htmlText;
}
public void DeleteHtmlText(int ModuleId)
public void DeleteHtmlText(int moduleId)
{
try
{
HtmlTextInfo HtmlText = _db.HtmlText.Where(item => item.ModuleId == ModuleId).FirstOrDefault();
_db.HtmlText.Remove(HtmlText);
_db.SaveChanges();
}
catch
{
throw;
}
HtmlTextInfo htmlText = _db.HtmlText.FirstOrDefault(item => item.ModuleId == moduleId);
if (htmlText != null) _db.HtmlText.Remove(htmlText);
_db.SaveChanges();
}
}
}

View File

@ -1,13 +1,12 @@
using System.Collections.Generic;
using Oqtane.Modules.HtmlText.Models;
using Oqtane.Modules.HtmlText.Models;
namespace Oqtane.Modules.HtmlText.Repository
{
public interface IHtmlTextRepository
{
HtmlTextInfo GetHtmlText(int ModuleId);
HtmlTextInfo AddHtmlText(HtmlTextInfo HtmlText);
HtmlTextInfo UpdateHtmlText(HtmlTextInfo HtmlText);
void DeleteHtmlText(int ModuleId);
HtmlTextInfo GetHtmlText(int moduleId);
HtmlTextInfo AddHtmlText(HtmlTextInfo htmlText);
HtmlTextInfo UpdateHtmlText(HtmlTextInfo htmlText);
void DeleteHtmlText(int moduleId);
}
}