public IActionResult GetRolePowerMebmer(int roleid) { Tright_Role_Power_Da userroleManage = new Tright_Role_Power_Da(); var list = userroleManage.Select.Where(s => s.Role_Id == roleid).ToList(); return(SuccessResultList(list)); }
public IActionResult AddRole(Tright_Role model) { if (string.IsNullOrEmpty(model.Role_Name)) { return(FailMessage("角色名不能为空!")); } Tright_Role_Da da = new Tright_Role_Da(); var role = da.Insert(model); Tright_Power_Da powerda = new Tright_Power_Da(); Tright_Power powermodel = new Tright_Power(); powermodel.Power_Type = model.Role_Name + "权限"; var power = powerda.Insert(powermodel); Tright_Role_Power_Da rolepowerda = new Tright_Role_Power_Da(); Tright_Role_Power rolepowermodel = new Tright_Role_Power(); rolepowermodel.Role_Id = role.Id; rolepowermodel.Power_Id = power.Id; rolepowerda.Insert(rolepowermodel); return(SuccessMessage("添加成功!")); }
public IActionResult DeletedRoleMenuMebmer(int menuid, int roleid) { Tright_Role_Power_Da da = new Tright_Role_Power_Da(); var rp = da.Select.Where(s => s.Role_Id == roleid).ToOne(); Tright_Power_Menu_Da poda = new Tright_Power_Menu_Da(); if (poda.Delete(s => s.Menu_Id == menuid && s.Power_Id == rp.Power_Id) > 0) { return(SuccessMessage("已删除!")); } return(FailMessage("删除失败")); }
public IActionResult AddRoleMenuMebmer(int menuid, int roleid) { Tright_Role_Power_Da da = new Tright_Role_Power_Da(); var rp = da.Select.Where(s => s.Role_Id == roleid).ToOne(); Tright_Power_Menu_Da poda = new Tright_Power_Menu_Da(); Tright_Power_Menu model = new Tright_Power_Menu(); model.Power_Id = rp.Power_Id; model.Menu_Id = menuid; poda.InsertOrUpdate(model); return(SuccessMessage("已添加!")); }
public IActionResult AddRolePowerMebmer(int roleid, int operationid) { Tright_Role_Power_Da da = new Tright_Role_Power_Da(); var rp = da.Select.Where(s => s.Role_Id == roleid).ToOne(); Tright_Power_Opeartion_Da poda = new Tright_Power_Opeartion_Da(); Tright_Power_Opeartion model = new Tright_Power_Opeartion(); model.Power_Id = rp.Power_Id; model.Operation_Id = operationid; poda.InsertOrUpdate(model); return(SuccessMessage("已添加!")); }
public IActionResult DeletedRolePowerMebmer(int id) { Tright_Role_Power_Da userroleManage = new Tright_Role_Power_Da(); var model = userroleManage.Select.Where(s => s.Id == id); if (model == null) { return(SuccessMessage("请不要反复取消!"));; } if (userroleManage.Delete(s => s.Id == id) > 0) { return(SuccessMessage("已取消!")); } return(FailMessage()); }
public IActionResult DelRole(int id) { Tright_Role_Da da = new Tright_Role_Da(); Tright_Role_Power_Da rpda = new Tright_Role_Power_Da(); var rp = rpda.Select.Where(s => s.Role_Id == id).ToOne(); Tright_Power_Da powerda = new Tright_Power_Da(); if (da.Delete(s => s.Id == id) > 0 && powerda.Delete(s => s.Id == rp.Power_Id) > 0) { return(SuccessMessage("已删除!")); } return(FailMessage()); }
public IActionResult AddRolePowerMebmer(int roleid, int powerid) { Tright_Role_Power_Da Manage = new Tright_Role_Power_Da(); if (Manage.Select.Where(s => s.Roleid == roleid && s.Powerid == powerid).Count() > 0) { return(SuccessMessage("请不要反复添加!")); } Tright_Role_Power model = new Tright_Role_Power { Roleid = roleid, Powerid = powerid }; Manage.Insert(model); return(SuccessMessage("已添加!")); }