Dynamic user profile per tenant
This commit is contained in:
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