Aspnetcore.docs: Missing GetTodoItem method in POST section?

Created on 12 Mar 2020  Â·  3Comments  Â·  Source: dotnet/AspNetCore.Docs

I think the scaffolding may have changed as I am unable to build with the code for the POST method. It cannot find the GetTodoItem method which I assume is because this does not exist yet in the GET method. I am going to work forwards through the rest of the code and see if it fixes it.

My scaffolded code:
// GET: TodoItems
public async Task<IActionResult> Index()
{
return View(await _context.TodoItems.ToListAsync());
}


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Not Triaged Source - Docs.ms

All 3 comments

I've been looking into this and it seems that the scaffolded controller inherits from Controller but in your code it inherits from Controller:Base. The scaffolded controller I have also scaffolds views which I believe I should not have.

I managed to get my POST working by removing all the views and commenting out other methods for now. After doing some digging - It looks like the scaffolded controller in .NET Core has to use the MVC approach with views. I believe your tutorial must use the scaffolding from .NET or perhaps an old scaffolding.

The tutorial works. I'm not sure what step you missed. You might try asking on StackOverflow,.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rick-Anderson picture Rick-Anderson  Â·  3Comments

YeyoCoder picture YeyoCoder  Â·  3Comments

danroth27 picture danroth27  Â·  3Comments

Rick-Anderson picture Rick-Anderson  Â·  3Comments

serpent5 picture serpent5  Â·  3Comments