New Angular based web version #1
@@ -25,14 +25,17 @@ public static class DeleteCar
|
|||||||
.Where(x => x.Id == new CarId(id))
|
.Where(x => x.Id == new CarId(id))
|
||||||
.ExecuteDeleteAsync(cancellationToken);
|
.ExecuteDeleteAsync(cancellationToken);
|
||||||
|
|
||||||
|
if (rows == 0)
|
||||||
|
{
|
||||||
|
return TypedResults.NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
if (rows > 1)
|
if (rows > 1)
|
||||||
{
|
{
|
||||||
var logger = loggerFactory.CreateLogger(nameof(DeleteCar));
|
var logger = loggerFactory.CreateLogger(nameof(DeleteCar));
|
||||||
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{CarId}'", rows, id);
|
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{CarId}'", rows, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows > 0
|
return TypedResults.NoContent();
|
||||||
? TypedResults.NoContent()
|
|
||||||
: TypedResults.NotFound();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,14 +25,17 @@ public static class DeleteConsumption
|
|||||||
.Where(x => x.Id == new ConsumptionId(id))
|
.Where(x => x.Id == new ConsumptionId(id))
|
||||||
.ExecuteDeleteAsync(cancellationToken);
|
.ExecuteDeleteAsync(cancellationToken);
|
||||||
|
|
||||||
|
if (rows == 0)
|
||||||
|
{
|
||||||
|
return TypedResults.NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
if (rows > 1)
|
if (rows > 1)
|
||||||
{
|
{
|
||||||
var logger = loggerFactory.CreateLogger(nameof(DeleteConsumption));
|
var logger = loggerFactory.CreateLogger(nameof(DeleteConsumption));
|
||||||
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{ConsumptionId}'", rows, id);
|
logger.LogWarning("Deleted '{DeletedRowCount}' rows for id '{ConsumptionId}'", rows, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows > 0
|
return TypedResults.NoContent();
|
||||||
? TypedResults.NoContent()
|
|
||||||
: TypedResults.NotFound();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user