This commit is contained in:
thermalthrottle
2021-03-20 22:01:21 +02:00
4 changed files with 126 additions and 55 deletions

View File

@@ -390,22 +390,15 @@ namespace Business.Business.Sales
public void RemoveAmount(int productId, double Amount)
{
if (currentUser.RoleId > 1)
var product = Get(productId);
if (product != null)
{
var product = Get(productId);
if (product != null)
{
product.AmountInStock -= Amount;
context.SaveChanges();
}
else
{
throw new ArgumentException("Product id not valid!");
}
product.AmountInStock -= Amount;
context.SaveChanges();
}
else
{
throw new ArgumentException("Insufficient Role!");
throw new ArgumentException("Product id not valid!");
}
}