0
我试图将基于视图的应用程序更改为API。 关闭此项目here。我不能退还OkObjectResult
。为什么会这样呢,为什么ASP的价格是IActionResult
vs ActionResult
?不可用的OkObjectResult不能像方法一样使用
[HttpGet]
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 OkObjectResult(model);
}