Prueba2
This commit is contained in:
parent
bc07e3ebd9
commit
2582de76ff
@ -284,7 +284,6 @@ namespace WebVentaCoche.Controllers
|
||||
if (result.Succeeded)
|
||||
return RedirectToAction(nameof(Index));
|
||||
|
||||
// Si hay errores, los mostramos
|
||||
foreach (var e in result.Errors)
|
||||
ModelState.AddModelError("", e.Description);
|
||||
return View(model);
|
||||
|
||||
@ -26,10 +26,8 @@
|
||||
value="@Model.Price.ToString(System.Globalization.CultureInfo.InvariantCulture)"
|
||||
step="0.01" required />
|
||||
</div>
|
||||
<!-- Botón Guardar -->
|
||||
<button type="button" id="updateProduct" class="btn btn-primary mt-3">Guardar</button>
|
||||
|
||||
<!-- Botón Volver a la lista -->
|
||||
<div class="text-right mt-3">
|
||||
<a href="/Admin/Products" class="btn btn-secondary">Volver a la lista</a>
|
||||
</div>
|
||||
@ -44,14 +42,13 @@
|
||||
$(document).ready(function () {
|
||||
const productId = @Model.Id;
|
||||
|
||||
// PUT: Actualizar producto
|
||||
$('#updateProduct').click(function () {
|
||||
const updatedProduct = {
|
||||
id: productId,
|
||||
name: $('#Name').val(),
|
||||
shortDescription: $('#ShortDescription').val(),
|
||||
longDescription: $('#LongDescription').val(),
|
||||
price: parseFloat($('#Price').val()) // Asegúrate de que sea un número
|
||||
price: parseFloat($('#Price').val())
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
@ -69,7 +66,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
// DELETE: Eliminar producto
|
||||
$('#deleteProduct').click(function () {
|
||||
if (confirm('¿Estás seguro de que deseas eliminar este producto?')) {
|
||||
$.ajax({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user