I have only one view in my project, of which the user has to enter a client name to look for it in a mailbox.
<form action="registrarCliente" method="post">
<input id="textCliente" name="textCliente" /> <input id="btnAdd"
type="submit" value="Añadir" />
</form>
<form action="eliminarCliente" method="post">
<input id="textCliente" name="textCliente" /> <input id="btnDel"
type="submit" value="Eliminar" />
</form>
This way I recover the data of the view, but when passing it to the controller, it opens another url address with a view that does not exist.
[HttpGet]
public ActionResult registrarCliente(String nombre, String textCliente)
{
CorreosServices correosServices = new CorreosServices();
correosServices.añadirCliente(textCliente);
return View("/home/index");
}
[HttpGet]
public ActionResult eliminarCliente(String nombre, String textCliente)
{
CorreosServices correosServices = new CorreosServices();
correosServices.eliminarCliente(textCliente);
return View("/home/index");
}
I would like to refresh the page of / home / index, instead of returning the url / registerCliente or / deleteCliente, which do not exist.