I have a code that queries a WebApi, writes to the database, and queries the database, in this application, a view that has 3 buttons, namely:
- Query Ws
- Insert BD
- BD Query
I'm using @ Html.BeginForm to submit the button action and call ActionResult responsible for each render.
In the passage of parameters, only one action is allowed (obviously). How do I make it to have a "decision-making" or an "if", so that it calls the correct action by clicking its button?
Would it be better to use another type of form? Or any other ways for this?
In the code below the "QueryWs" is the parameterized action that "should change" when clicking a button other than "btnCsWs".
@using (@Html.BeginForm("ConsultaWs", "Home", FormMethod.Get))
{
<text>codigo do país</text>
@Html.TextBoxFor(model => model.RestResponse.result.country)
<text>codigo do estado</text>
@Html.TextBoxFor(model => model.RestResponse.result.abbr)
<button type="submit" name="btnCsWs">Consulta WS</button>
<button type="submit" name="btnInsereDB">Insere DB</button>
<button type="submit" name="btnCsDB">Consulta DB</button>
}