❔ Help in CRUD Update in .net Core and cshtml
I apologize cause this is a simple question, I am studying .net and I really want to be able to make an Update function I have created a .net 6 MVC solution
I created a CardsController:
https://codeshare.io/WdD79d
I created a route for my actions:
https://codeshare.io/Rb4NOB
I created a function in cshtml for the Delete and Update:
https://codeshare.io/YLJgKb
And when I call the UpdateCard function in the cshtml I get two errors in the console: PUT https://localhost:44307/Cards/Update/9 net::ERR_ABORTED 400 Error updating card.
Note: The Delete Function works Can you look at my simple code and point out where the error might be?
4 Replies
Any p[articular reason you don't use attribute routing?
And I see the issue
Your
Update
endpoint is [HttpGet]
but in your JS code you send a PUT
request to it
So change [HttpGet]
to [HttpPut]
No, I'm just newbie trying to learn
There are two [http] Update, one with [HttpGet] and one with [HttpPut]
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.