Initial commit

This commit is contained in:
oqtane
2019-05-04 20:32:08 -04:00
committed by Shaun Walker
parent 2f232eea7e
commit d71de1c21f
177 changed files with 8536 additions and 0 deletions

View File

@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Oqtane.Models;
using Oqtane.Shared.Modules.HtmlText.Models;
using Oqtane.Repository;
using Oqtane.Modules;
namespace Oqtane.Server.Modules.HtmlText.Repository
{
public class HtmlTextContext : ContextBase, IService
{
public virtual DbSet<HtmlTextInfo> HtmlText { get; set; }
public HtmlTextContext(ITenantRepository TenantRepository):base(TenantRepository)
{
// ContextBase handles multi-tenant database connections
}
}
}

View File

@ -0,0 +1,83 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using Oqtane.Shared.Modules.HtmlText.Models;
using Oqtane.Modules;
namespace Oqtane.Server.Modules.HtmlText.Repository
{
public class HtmlTextRepository : IHtmlTextRepository, IService
{
private readonly HtmlTextContext db;
public HtmlTextRepository(HtmlTextContext context)
{
db = context;
}
public IEnumerable<HtmlTextInfo> GetHtmlText()
{
try
{
return db.HtmlText.ToList();
}
catch
{
throw;
}
}
public void AddHtmlText(HtmlTextInfo HtmlText)
{
try
{
db.HtmlText.Add(HtmlText);
db.SaveChanges();
}
catch
{
throw;
}
}
public void UpdateHtmlText(HtmlTextInfo HtmlText)
{
try
{
db.Entry(HtmlText).State = EntityState.Modified;
db.SaveChanges();
}
catch
{
throw;
}
}
public HtmlTextInfo GetHtmlText(int HtmlTextId)
{
try
{
HtmlTextInfo HtmlText = db.HtmlText.Find(HtmlTextId);
return HtmlText;
}
catch
{
throw;
}
}
public void DeleteHtmlText(int HtmlTextId)
{
try
{
HtmlTextInfo HtmlText = db.HtmlText.Find(HtmlTextId);
db.HtmlText.Remove(HtmlText);
db.SaveChanges();
}
catch
{
throw;
}
}
}
}

View File

@ -0,0 +1,14 @@
using System.Collections.Generic;
using Oqtane.Shared.Modules.HtmlText.Models;
namespace Oqtane.Server.Modules.HtmlText.Repository
{
public interface IHtmlTextRepository
{
IEnumerable<HtmlTextInfo> GetHtmlText();
void AddHtmlText(HtmlTextInfo HtmlText);
void UpdateHtmlText(HtmlTextInfo HtmlText);
HtmlTextInfo GetHtmlText(int HtmlTextIdId);
void DeleteHtmlText(int HtmlTextId);
}
}