Feat: PS1 Añadido - Fix: Eliminación de Equipos

This commit is contained in:
2025-10-08 13:51:27 -03:00
parent 268c1c2bf9
commit afd378712c
4 changed files with 264 additions and 6 deletions

View File

@@ -189,15 +189,13 @@ namespace Inventario.API.Controllers
[HttpDelete("{id}")]
public async Task<IActionResult> Borrar(int id)
{
var query = "DELETE FROM dbo.equipos WHERE Id = @Id AND Origen = 'manual';";
var query = "DELETE FROM dbo.equipos WHERE Id = @Id;";
using (var connection = _context.CreateConnection())
{
var filasAfectadas = await connection.ExecuteAsync(query, new { Id = id });
if (filasAfectadas == 0)
{
// Puede que no se haya borrado porque no existe o porque es automático.
// Damos un mensaje de error genérico pero informativo.
return NotFound("Equipo no encontrado o no se puede eliminar porque fue generado automáticamente.");
return NotFound("Equipo no encontrado.");
}
return NoContent();
}

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Inventario.API")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+177ad5596221b094cc62c04b38044cc9f09a107e")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+268c1c2bf99b66ab7fb5c6dd1a2d1134d636839e")]
[assembly: System.Reflection.AssemblyProductAttribute("Inventario.API")]
[assembly: System.Reflection.AssemblyTitleAttribute("Inventario.API")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]