Grettings friends. So i have been researching this site for a looong time and i have not gotten a satisfactory answer to my question.
This is my Controller:
public ActionResult EliminarLibro(string bookId)
{
bookModel ModeloLibro = new bookModel();
ModeloLibro.EliminarLibro(bookId);
TempData["message"] = "Se ha eliminado el libro correctamente.";
return RedirectToAction("GestionBiblioteca");
}
And this is my Ajax in a view:
var myBookId = $('.parrafo-codigo').text();
$.ajax({
type: "GET",
url: "/Home/VerificarEliminarLibro",
data: { bookId: myBookId },
datatype: "json",
success: function (data) {
// $('#result').html(data);
if (data.esteLibroEstaPrestado == true) {
$('#delModal').modal('hide'); // Quito modal de pregunta si se elimina
$('#errModal').modal('show'); // Muestra modal de error
} else {
window.location.href = '/Home/EliminarLibro/' + myBookId;
}
}
});
The question is: how to make ActionResult EliminarLibro inaccessible via URL (for example XXXX/Home/EliminarLibro/0000532307) but is need to be called from ajax?