-1

I got below class:

public class AllRegistrationsViewComponent : ViewComponent
{
 private readonly UserManager<IdentityUser> um;
 private readonly MyContext myContext;

 public AllRegistrationsViewComponent(UserManager<IdentityUser> um, MyContext myContext)
 {
   this.um = um;
   this.myContext= myContext;
 }

 public async Task<IViewComponentResult> Invoke()
 {
   var allUsers= await um.Users.ToList();
   return View(allUsers);
 }
}

And I'm getting below message:

List <IdentityUser> does not contain a definition for GetAwaiter and no accessible method 
GetAwaiter accepting a first argument of type List<IdentityUser> could be found
4est
  • 3,010
  • 6
  • 41
  • 63

1 Answers1

2

Just change this line from

 var allUsers= await um.Users.ToList();

To

var allUsers= await um.Users.ToListAsync();
Ishwar Gagare
  • 723
  • 3
  • 9