using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Txgy.EWS.Client.Entity; using Txgy.EWS.Client.IBLL; using Txgy.EWS.Client.IDAL; namespace Txgy.EWS.Client.BLL { public class RoleBLL : IRoleBLL { IRoleDal _roleDal; public RoleBLL(IRoleDal roleDal) { _roleDal = roleDal; } public async Task> GetAll() { var rolesStr = await _roleDal.GetAll(); return Newtonsoft.Json.JsonConvert.DeserializeObject>(rolesStr); } public async Task> GetAllByUserId(int userId) { var rolesStr = await _roleDal.GetAllByUserId(userId); return Newtonsoft.Json.JsonConvert.DeserializeObject>(rolesStr); } public async Task> GetAllUsers(int roleId) { var usersStr = await _roleDal.GetAllUsers(roleId); return Newtonsoft.Json.JsonConvert.DeserializeObject>(usersStr); } public Task Save(RoleEntity role, List userIds, List menuIds) { return _roleDal.Save(Newtonsoft.Json.JsonConvert.SerializeObject(role), Newtonsoft.Json.JsonConvert.SerializeObject(userIds), Newtonsoft.Json.JsonConvert.SerializeObject(menuIds) ); } } }