Я слежу за турориалом: https://www.c-sharpcorner.com/article/asp-net-core-mvc-authentication-and-role-based-authorization-with-asp-net-core/
У меня есть ошибка в AplpicationController, которую я не знаю, как исправить. Я был бы очень признателен за помощь
В методе Index () ниже я получаю сообщение об ошибке в этой строке: NumberOfUsers = r.Users.Count - ApplicationRole не содержит определения для Users ...
Вот класс ApplicationController:
public IActionResult Index()
{
List<ApplicationRoleListViewModel> model = new List<ApplicationRoleListViewModel>();
model = roleManager.Roles.Select(r => new ApplicationRoleListViewModel
{
RoleName = r.Name,
Id = r.Id,
Description = r.Description,
NumberOfUsers = r.Users.Count
}).ToList();
return View(model);
Вот ApplicationRoleListViewModel
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CoreRole.Models
{
public class ApplicationRoleListViewModel
{
public string Id { get; set; }
public string RoleName { get; set; }
public string Description { get; set; }
public int NumberOfUsers { get; set; }
}
}