public JsonResult GridUser(int page, int rows, string search, string sidx, string sord)
        {
            var data = new List<UserManagerModel>();

            var tbl = new DynamicModel("ConnectionString", "aspnet_CustomProfile", "UserId");
            dynamic iduser = tbl.Query("SELECT m.ApplicationId, m.UserId, m.Email, cp.Name " +
                                       "FROM aspnet_Membership as m LEFT JOIN aspnet_CustomProfile as cp " +
                                       "ON m.UserId = cp.UserId " +
                                       "inner join aspnet_Applications as a " +
                                       "on a.ApplicationName = @0 and a.ApplicationId = m.ApplicationId " +
                                       "order by cp.Name", Portal.UniqueID);
            var table = new DynamicModel("ConnectionString", "aspnet_Roles", "RoleId");
            dynamic roles = table.Query("SELECT r.RoleName, ur.UserId " +
                                        "FROM aspnet_Roles r, aspnet_UsersInRoles ur " +
                                        "WHERE r.RoleId = ur.RoleId");
            var iRoles = (IEnumerable<dynamic>) roles;
            var i = 1;
            foreach (var user in iduser)
            {
                var m = new UserManagerModel();
                m.id = i;
                m.UserId = user.UserId;
                m.UserName = user.Name;
                m.UserEmail = user.Email;
                var userrolid = Guid.Parse(user.UserId.ToString());

                try
                {
                    var roleName = iRoles.Where(r => r.UserId == userrolid);
                    m.UserRol = roleName.Single().RoleName;

                }
                catch (Exception e)
                {
                    m.UserRol = "";
                }
                m.Edit = Builddir(m.UserEmail);
                data.Add(m);
                i++;
            }
            if (!string.IsNullOrEmpty(search))
            {
                return Search(search, page, rows, data);
            }
            var result = GetRowsFromList(data.AsQueryable(), rows, page);
            return result;
        }
        public ActionResult Module()
        {
            var segment = Request.Url.Segments;
            var pagenumber = getPageId(segment);
            var mid = (int)ControllerContext.RouteData.Values["moduleId"];
            var urlCreate = Path.ApplicationRoot + "/DesktopModules/CoreModules/Users/UsersManage.aspx?pageId=" + pagenumber +
                            "&mID=" + mid;
            var model = new UserManagerModel {UserEmail = urlCreate};

            return View(model);
        }