public JsonResult AddRole(int roleId, string roleName)
        {
            var check = _roleRepository.GetRoleByConditon(roleId, roleName);

            if (check.Count() > 1)
            {
                return Json(new { result = false, msg = "添加失败,不能重复添加相同的角色!" }, JsonRequestBehavior.AllowGet);
            }

            try
            {
                var role = new t_role
                {
                    roleid = roleId,
                    rolename = roleName
                };
                var result = _roleRepository.AddRole(role);
                if (result)
                {
                    return Json(new { result = true, msg = "" }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    return Json(new { result = false, msg = "操作失败!" }, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                return Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
        public bool DeleteRole(t_role role)
        {
            dbContext.Set<t_role>().Attach(role);

            dbContext.Entry<t_role>(role).State = EntityState.Deleted;

            return dbContext.SaveChanges() > 0;
        }
        public JsonResult DeleteRole(int roleId)
        {
            var role = new t_role
            {
                roleid = roleId

            };

            try
            {
                var result = _roleRepository.DeleteRole(role);
                if (result)
                {
                    return Json(new { result = true, msg = "" }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    return Json(new { result = false, msg = "操作失败!" }, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                return Json(new { result = false, msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
 //public List<string> GetRoleNameByUserId(string userId)
 //{
 //    return dbContext.t_role.Where(m=>m.t_user.Any(n=>n.userid==userId)).sele;
 //}
 public bool AddRole(t_role role)
 {
     dbContext.Entry<t_role>(role).State = EntityState.Added;
     return dbContext.SaveChanges() > 0;
 }