OpenAuth.Net/OpenAuth.App/ModuleManagerApp.cs

64 lines
1.6 KiB
C#
Raw Normal View History

2017-11-29 20:49:14 +08:00
using System.Collections.Generic;
2017-12-11 22:59:36 +08:00
using System.Linq;
2017-11-29 20:49:14 +08:00
using OpenAuth.Repository.Domain;
2015-11-21 23:56:39 +08:00
namespace OpenAuth.App
{
2017-12-11 17:49:59 +08:00
public class ModuleManagerApp :BaseApp<Module>
2015-11-21 23:56:39 +08:00
{
2017-12-11 17:49:59 +08:00
public void Add(Module model)
2015-11-21 23:56:39 +08:00
{
2017-12-11 17:49:59 +08:00
ChangeModuleCascade(model);
Repository.Add(model);
2015-11-21 23:56:39 +08:00
}
2017-12-11 17:49:59 +08:00
public void Update(Module model)
2015-11-21 23:56:39 +08:00
{
2017-12-11 17:49:59 +08:00
ChangeModuleCascade(model);
Repository.Update(u =>u.Id, model);
2015-11-21 23:56:39 +08:00
}
#region /
/// <summary>
/// 加载特定用户的模块
/// TODO:这里会加载用户及用户角色的所有模块,“为用户分配模块”功能会给人一种混乱的感觉,但可以接受
/// </summary>
/// <param name="userId">The user unique identifier.</param>
2017-10-11 16:19:34 +08:00
public List<Module> LoadForUser(string userId)
2015-11-30 00:12:42 +08:00
{
return null;
}
/// <summary>
/// 加载特定角色的模块
/// </summary>
/// <param name="roleId">The role unique identifier.</param>
2017-10-11 16:19:34 +08:00
public List<Module> LoadForRole(string roleId)
{
return null;
}
#endregion /
2017-12-11 22:59:36 +08:00
#region
/// <summary>
/// 删除指定的菜单
/// </summary>
/// <param name="ids"></param>
public void DelMenu(string[] ids)
{
UnitWork.Delete<ModuleElement>(u => ids.Contains(u.Id));
}
public void AddMenu(ModuleElement model)
{
UnitWork.Add(model);
}
#endregion
2015-11-21 23:56:39 +08:00
}
}