So I would like a second set of eyes. I wanted to try editing the pre-existing record on my card view (see the screenshot attached) like Beachfront Villa -> Beachfront Villa 8. Even this easy modification does not succeed, as on clicking the save button I got "record not found"
And this comes from here in the controller
` [HttpPost] public async Task<IActionResult> Update(ListingProjects updatedUserModelRef) { if (oldListingProjects == null) { if (Request.Headers["X-Requested-With"] == "XMLHttpRequest") { return Json(new { success = false, message = "Record not found." }); //this is the error i see on View } return NotFound(); }
` [HttpPost] public async Task<IActionResult> Update(ListingProjects updatedUserModelRef) { if (oldListingProjects == null) { if (Request.Headers["X-Requested-With"] == "XMLHttpRequest") { return Json(new { success = false, message = "Record not found." }); //this is the error i see on View } return NotFound(); }
my database has not the id "1" referred in that devtool:
mysql> Select * from ListingDBTable;+----+----------------------+----------------------------------+------------+------------+| Id | ListingName | ImageUrl | CategoryId | LocationId |+----+----------------------+----------------------------------+------------+------------+| 5 | Beachfront Villa | http://example.com/villa.jpg | 1 | 1 || 6 | hidden moon building | hiddenmoon | 1 | 1 || 74 | New Listing | http://example.com/new_image.jpg | 1 | 1 |+----+----------------------+----------------------------------+------------+------------+
mysql> Select * from ListingDBTable;+----+----------------------+----------------------------------+------------+------------+| Id | ListingName | ImageUrl | CategoryId | LocationId |+----+----------------------+----------------------------------+------------+------------+| 5 | Beachfront Villa | http://example.com/villa.jpg | 1 | 1 || 6 | hidden moon building | hiddenmoon | 1 | 1 || 74 | New Listing | http://example.com/new_image.jpg | 1 | 1 |+----+----------------------+----------------------------------+------------+------------+
`
my save button on View should have been picking up any ids listed here (5,6, or 74) but as the devtool shows it picks up 1 instead. i suppose if it picks up 5,6,74 it will let me edit the ListingName property.