public IActionResult GetAllRole() { Tright_Role_Da rolemanger = new Tright_Role_Da(); var list = rolemanger.Select.OrderBy(s => s.Id).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 DelRole(int id) { Tright_Role_Da da = new Tright_Role_Da(); if (da.Delete(s => s.Id == id) > 0) { return(SuccessMessage("已删除!")); } return(FailMessage()); }
public IActionResult UpdateRole(Tright_Role model) { if (string.IsNullOrEmpty(model.Role_Name)) { return(FailMessage("角色名不能为空!")); } Tright_Role_Da da = new Tright_Role_Da(); da.Update(model); return(SuccessMessage("成功!")); }
public IActionResult AddRole(Tright_Role model) { if (string.IsNullOrEmpty(model.Rolename)) { return(FailMessage("角色名不能为空!")); } Tright_Role_Da da = new Tright_Role_Da(); da.Insert(model); return(SuccessMessage("添加成功!")); }
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 ListRole() { Tright_Role_Da da = new Tright_Role_Da(); return(SuccessResultList(da.Select.ToList())); }