how to call controller method from button click mvc code example

Example 1: To call any action method from the view on button click

@using (Html.BeginForm("Edit", "Home", new { Id = emp.Id }, FormMethod.Get))
                            {
                                <button>EDIT</button>
                            }
@using (Html.BeginForm("Delete", "Home", new { Id = emp.Id }, FormMethod.Post))
                            {
                                <button>DELETE</button>
                            }

Example 2: To call any action method from the view on button click in mvc

BY LOVE
Here, Action name=Edit, ControllerName=Home.
@using (Html.BeginForm("Edit", "Home", new { Id = emp.Id }, FormMethod.Get))
                            {
                                <button>EDIT</button>
                            }
@using (Html.BeginForm("Delete", "Home", new { Id = emp.Id }, FormMethod.Post))
                            {
                                <button>DELETE</button>
                            }

Tags:

Misc Example