Ejemplo n.º 1
0
        /// <summary>
        /// 人员角色数据源
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> UserRole_Read(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                //Guid roleid = new Guid(id);
                int             roleid  = Convert.ToInt32(id);
                List <UserRole> findall = await UserRoleRepository.FindAllAsync();

                IEnumerable <UserRole> iur = findall.Where(u => u.RoleID == roleid);
                if (iur != null && iur.Count() != 0)
                {
                    List <User> lUser = new List <User>();
                    foreach (UserRole item in iur)
                    {
                        User findu = await UserRepository.FindAsync(u => u.UserID == item.UserID);

                        lUser.Add(findu);
                    }
                    return(Json(lUser));
                }
            }
            return(Json(new { }));
        }