Skip to content

Instantly share code, notes, and snippets.

@karthikeyanVK
Created February 14, 2020 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthikeyanVK/d009ad79f4da95d864f0e4d17aa6c94f to your computer and use it in GitHub Desktop.
Save karthikeyanVK/d009ad79f4da95d864f0e4d17aa6c94f to your computer and use it in GitHub Desktop.
public bool UpdateProductQuantity(OrderedProduct orderedProduct)
{
using (var context = new PetShopContext())
{
var productFromDb = context.Products.Find(orderedProduct.ProductId);
productFromDb.Quantity -= orderedProduct.OrderedProductQuantity;
context.SaveChanges();
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment