public bool AddProductSize(int pid, SizeModel model) { using (ShoppingELFEntities context = new ShoppingELFEntities()) { SizeTable st = new SizeTable() { ProductID = pid, productSize = model.productSize, productPrice = model.productPrice, productQuantity = model.productQuantity }; context.SizeTable.Add(st); context.SaveChanges(); SelectMininmumPrice(pid); } return(true); }
public bool EditProduct(int pid, SizeModel model) { using (ShoppingELFEntities context = new ShoppingELFEntities()) { var product = context.SizeTable.FirstOrDefault(x => x.PID == pid); if (product != null) { product.productPrice = model.productPrice; product.productQuantity = model.productQuantity; product.productSize = model.productSize; context.SaveChanges(); return(true); } else { return(false); } } }