Fix: Limpieza Registro "DeletedAd" de Tabla "Ads" y Registro de Estado (Palabra).
This commit is contained in:
@@ -829,6 +829,10 @@ public class AdsV2Controller : ControllerBase
|
|||||||
{
|
{
|
||||||
ad.DeletedAt = DateTime.UtcNow;
|
ad.DeletedAt = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ad.DeletedAt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// 📝 AUDITORÍA
|
// 📝 AUDITORÍA
|
||||||
var statusBrandName = (await _context.Brands.FindAsync(ad.BrandID))?.Name ?? "";
|
var statusBrandName = (await _context.Brands.FindAsync(ad.BrandID))?.Name ?? "";
|
||||||
@@ -838,7 +842,7 @@ public class AdsV2Controller : ControllerBase
|
|||||||
Entity = "Ad",
|
Entity = "Ad",
|
||||||
EntityID = ad.AdID,
|
EntityID = ad.AdID,
|
||||||
UserID = userId,
|
UserID = userId,
|
||||||
Details = $"Estado de aviso ({statusBrandName} {ad.VersionName}) cambiado de {oldStatus} a {newStatus}."
|
Details = $"Estado de aviso ({statusBrandName} {ad.VersionName}) cambiado de {AdStatusHelper.GetStatusDisplayName(oldStatus)} a {AdStatusHelper.GetStatusDisplayName(newStatus)}."
|
||||||
});
|
});
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|||||||
@@ -35,6 +35,27 @@ public enum AdStatusEnum
|
|||||||
Reserved = 10
|
Reserved = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class AdStatusHelper
|
||||||
|
{
|
||||||
|
public static string GetStatusDisplayName(int statusId)
|
||||||
|
{
|
||||||
|
return statusId switch
|
||||||
|
{
|
||||||
|
1 => "Borrador",
|
||||||
|
2 => "Pago Pendiente",
|
||||||
|
3 => "En Revisión",
|
||||||
|
4 => "Activo",
|
||||||
|
5 => "Rechazado",
|
||||||
|
6 => "Pausado",
|
||||||
|
7 => "Vendido",
|
||||||
|
8 => "Vencido",
|
||||||
|
9 => "Eliminado",
|
||||||
|
10 => "Reservado",
|
||||||
|
_ => "Desconocido"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
public int UserID { get; set; }
|
public int UserID { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user