New answers tagged repository
2
Are you sure that you need two queries for this?
E.g. you could do something like this:
UPDATE Product
SET Quantity = Quantity - @usedQuantity
WHERE Id = @productId
AND Quantity >= @usedQuantity
Try to execute that and if it doesn't affect 1 row - you don't have enough quantity for the line item.
The drawback for your current logic is that you no ...
Top 50 recent answers are included
Related Tags
repository × 140c# × 106
design-patterns × 41
entity-framework × 36
php × 16
.net × 13
object-oriented × 9
mvc × 9
dependency-injection × 9
laravel × 9
asp.net-web-api × 9
asp.net-mvc × 8
java × 7
unit-testing × 7
dapper × 6
database × 5
asp.net × 5
asp.net-core × 5
interface × 4
unity-container × 4
beginner × 3
vba × 3
generics × 3
mvvm × 3
hibernate × 3