'Edit action has not been hitting while I push the submit button

I have an edit button in each row of my Datatable. I have two actions for editing. One for Getting data in a Datatable and the other one for posting my information. The code behind my Edit button in the my Home Index is:

{
 "data": "Id",
 "render": function (data, type, full, meta) {
  return `<div class="text-center"> <a class="btn btn-info" 
      href="/Home/EditGet/` + data + `"   >Edit</a> </div> `;
}  

and my home controller methods are:

/// Get Edit

    [HttpGet]
    [Route("{Id}")]
    public IActionResult EditGet(int? id)
    {

        if (id == null || id == 0)
        {
            return NotFound();
        }
        var obj = _sv.OpenRecord(id);
        if (obj == null)
        {
            return NotFound();
        }
        
        return View("EditGet", obj);
    }

/// Post Edit

    [HttpPost]
    public IActionResult EditPost(SalesVeiwModel sales)
    {
        if (ModelState.IsValid)
        {
           var res=  _sv.Update(sales.Comment);
            if (res==null )
            {
                return Json(data: "Not found");
            }
            return RedirectToAction("EditGet");
        }
            return Json(data: "Is not valid");
    }

And finally my EditGet view is like bellow:

  <form id="contact-form" method="post" asp-controller="Home" asp-      
   action="EditPost" role="form" >
   <input asp-for="Id" hidden />
   <div class="form-group">
   <label>Invoice Nomber</label>
   <input id="form_IBNo" type="text" class="form-control" disabled asp-for="IBNo">
   </div>
   .
   .
   .

   <div class="col-md-12">
   <input type="submit" class="btn btn-success btn-send" value="Confirm"   asp- 
    controller="Home" asp-action="EditGet">
   </form>


Solution 1:[1]

You should have two buttons,one call EditGet,one call EditPost,here is a demo:

<form id="contact-form" method="post" asp-controller="Home" asp-      
   action="EditPost" role="form" >
   <input asp-for="Id" hidden />
   <div class="form-group">
   <label>Invoice Nomber</label>
   <input id="form_IBNo" type="text" class="form-control" disabled asp-for="IBNo">
   </div>
   .
   .
   .

   <div class="col-md-12">
   <input type="submit" class="btn btn-success btn-send" value="Confirm">
   <a class="btn btn-success btn-send" value="Confirm" asp-controller="Home" asp-action="EditGet" asp-route-id="1">EditGet</a>
    </div>
   </form>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yiyi You