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,96 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using Oqtane.Models;
namespace Oqtane.Repository
{
public class PageModuleRepository : IPageModuleRepository
{
private TenantContext db;
public PageModuleRepository(TenantContext context)
{
db = context;
}
public IEnumerable<PageModule> GetPageModules()
{
try
{
return db.PageModule.ToList();
}
catch
{
throw;
}
}
public IEnumerable<PageModule> GetPageModules(int PageId)
{
try
{
List<PageModule> pagemodules = db.PageModule.Where(item => item.PageId == PageId)
.Include(item => item.Module)
.ToList();
return pagemodules;
}
catch
{
throw;
}
}
public void AddPageModule(PageModule PageModule)
{
try
{
db.PageModule.Add(PageModule);
db.SaveChanges();
}
catch
{
throw;
}
}
public void UpdatePageModule(PageModule PageModule)
{
try
{
db.Entry(PageModule).State = EntityState.Modified;
db.SaveChanges();
}
catch
{
throw;
}
}
public PageModule GetPageModule(int PageModuleId)
{
try
{
PageModule PageModule = db.PageModule.Find(PageModuleId);
return PageModule;
}
catch
{
throw;
}
}
public void DeletePageModule(int PageModuleId)
{
try
{
PageModule PageModule = db.PageModule.Find(PageModuleId);
db.PageModule.Remove(PageModule);
db.SaveChanges();
}
catch
{
throw;
}
}
}
}