I’m having trouble with delete a property so in this code I try to find a property with matching store_id
, goods_id
, property_id
and property_name
:
public async Task DeleteGoodsProperty(string storeId, string goodsId, string propertyId ,string propertyName)
{
var property = await _onlinePosContext.TblGoodsproperties
.Where(s => s.StoreId == storeId &&
s.GoodsId == goodsId &&
s.PropertyId== propertyId &&
s.PropertyName == propertyName)
.FirstOrDefaultAsync();
if (property != null)
{
_onlinePosContext.TblGoodsproperties.RemoveRange(property);
await _onlinePosContext.SaveChangesAsync();
}
}
Expected result: delete property named Chocolate
with goods_id
is 0030001
Outcome result: delete entire table with the same property_id
Response seem fine
This data will be wiped out after trying to use delete function
I did try to use auto increment for delete specific property but it still delete all.
Both Remove
and RemoveRange
have the same result
Kisotama is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.