public void UpdateSoldProductQuantity() { HalloweenEntities data = new HalloweenEntities(); foreach (var item in cart) { data.Products.Find(item.ProductID).OnHand -= item.Quantity; data.SaveChanges(); } data.SaveChanges(); }
public ActionResult Registration(User user) { //Validation if (ModelState.IsValid) { using (HalloweenEntities data = new HalloweenEntities()) { data.User.Add(user); data.SaveChanges(); } } return(RedirectToAction("Login", "User")); }