Dynamic user profile per tenant
This commit is contained in:
@ -11,6 +11,7 @@ namespace Oqtane.Repository
|
||||
public virtual DbSet<PageModule> PageModule { get; set; }
|
||||
public virtual DbSet<Module> Module { get; set; }
|
||||
public virtual DbSet<User> User { get; set; }
|
||||
public virtual DbSet<Profile> Profile { get; set; }
|
||||
public virtual DbSet<SiteUser> SiteUser { get; set; }
|
||||
public virtual DbSet<Role> Role { get; set; }
|
||||
public virtual DbSet<UserRole> UserRole { get; set; }
|
||||
|
15
Oqtane.Server/Repository/Interfaces/IProfileRepository.cs
Normal file
15
Oqtane.Server/Repository/Interfaces/IProfileRepository.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public interface IProfileRepository
|
||||
{
|
||||
IEnumerable<Profile> GetProfiles();
|
||||
IEnumerable<Profile> GetProfiles(int SiteId);
|
||||
Profile AddProfile(Profile Profile);
|
||||
Profile UpdateProfile(Profile Profile);
|
||||
Profile GetProfile(int ProfileId);
|
||||
void DeleteProfile(int ProfileId);
|
||||
}
|
||||
}
|
53
Oqtane.Server/Repository/ProfileRepository.cs
Normal file
53
Oqtane.Server/Repository/ProfileRepository.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public class ProfileRepository : IProfileRepository
|
||||
{
|
||||
private TenantDBContext db;
|
||||
|
||||
public ProfileRepository(TenantDBContext context)
|
||||
{
|
||||
db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<Profile> GetProfiles()
|
||||
{
|
||||
return db.Profile;
|
||||
}
|
||||
|
||||
public IEnumerable<Profile> GetProfiles(int SiteId)
|
||||
{
|
||||
return db.Profile.Where(item => item.SiteId == SiteId);
|
||||
}
|
||||
|
||||
public Profile AddProfile(Profile Profile)
|
||||
{
|
||||
db.Profile.Add(Profile);
|
||||
db.SaveChanges();
|
||||
return Profile;
|
||||
}
|
||||
|
||||
public Profile UpdateProfile(Profile Profile)
|
||||
{
|
||||
db.Entry(Profile).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Profile;
|
||||
}
|
||||
|
||||
public Profile GetProfile(int ProfileId)
|
||||
{
|
||||
return db.Profile.Find(ProfileId);
|
||||
}
|
||||
|
||||
public void DeleteProfile(int ProfileId)
|
||||
{
|
||||
Profile Profile = db.Profile.Find(ProfileId);
|
||||
db.Profile.Remove(Profile);
|
||||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user