2017-10-19 94 views
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); 
} 

回答

相關問題