//[HttpPost] public ActionResult Create(Product pro) { if (ModelState.IsValid) { db.Products.Add(pro); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pro)); }
public bool UpdateCustomer(Product _product) { try{ Product updatedproduct = (from c in entities.Products where c.Id == _product.Id select c).FirstOrDefault(); updatedproduct.Name = _product.Name; updatedproduct.Description = _product.Description; updatedproduct.price = _product.price; updatedproduct.Quantity = _product.Quantity; entities.SaveChanges(); return(true); } catch (Exception ex) { } return(true); }
public Product InsertCustomer(Product _product) { try{ using (SignupForm_TestEntities entities = new SignupForm_TestEntities()) { entities.Products.Add(_product); entities.SaveChanges(); } return(_product); } catch (Exception ex) { } return(_product); }