I am working on user roles and assigning role to a user using MVC identity. I am getting this error Using the generic type 'System.Collections.Generic.List' requires 1 type arguments

Here is my code.

public ActionResult Index(string searchStringUserNameOrEmail, string currentFilter, int? page)
{
    try
    {
        int intPage = 1;
        int intPageSize = 5;
        int intTotalPageCount = 0;
        if (searchStringUserNameOrEmail != null)
        {
            intPage = 1;
        }
        else
        {
            if (currentFilter != null)
            {
                searchStringUserNameOrEmail = currentFilter;
                intPage = page ?? 1;
            }
            else
            {
                searchStringUserNameOrEmail = "";
                intPage = page ?? 1;
            }
        }
        ViewBag.CurrentFilter = searchStringUserNameOrEmail;
        List col_UserDTO = new List(); //Error appears here
        int intSkip = (intPage - 1) * intPageSize;
        intTotalPageCount = UserManager.Users
            .Where(x => x.UserName.Contains(searchStringUserNameOrEmail))
            .Count();
        var result = UserManager.Users
            .Where(x => x.UserName.Contains(searchStringUserNameOrEmail))
            .OrderBy(x => x.UserName)
            .Skip(intSkip)
            .Take(intPageSize)
            .ToList();
        foreach (var item in result)
        {
            ExpandedUserDTO objUserDTO = new ExpandedUserDTO();
            objUserDTO.UserName = item.UserName;
            objUserDTO.Email = item.Email;
            objUserDTO.LockoutEndDateUtc = item.LockoutEndDateUtc;
            col_UserDTO.Add(objUserDTO);
        }
        // Set the number of pages
        var _UserDTOAsIPagedList =
            new StaticPagedList<List>
            (
                col_UserDTO, intPage, intPageSize, intTotalPageCount
                );
        return View(_UserDTOAsIPagedList);
    }
    catch (Exception ex)
    {
        ModelState.AddModelError(string.Empty, "Error: " + ex);
        List col_UserDTO = new List(); //Error appears here
        return View(col_UserDTO.ToPagedList(1, 25));
    }
}
#endregion

Help would be appreciated. Thanks

Related posts

Recent Viewed