public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public ActionResult Edit([Bind(Include = "PurchaseOrderId,CommodityId,CommodityAmount")] PurchaseOrder purchaseOrder) { if (ModelState.IsValid) { db.Entry(purchaseOrder).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(purchaseOrder)); }
public ActionResult Edit([Bind(Include = "Email,Name,Password,Status,Rank")] User user) { if (ModelState.IsValid) { db.Entry(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "id,Name,City,Age")] Dbfirstapproach dbfirstapproach) { if (ModelState.IsValid) { db.Entry(dbfirstapproach).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dbfirstapproach)); }
public ActionResult Edit([Bind(Include = "ID,Name,Gender,Email,Salary")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Edit([Bind(Include = "CommodityId,CommodityName,CommodityPrice,CommodityAmount,CommodityImage")] Commodity commodity) { if (ModelState.IsValid) { db.Entry(commodity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(commodity)); }
// POST: ProductSolds/Edit/5 // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://go.microsoft.com/fwlink/?LinkId=317598. public ActionResult Edit([Bind(Include = "ID,ProductID,CustomerID,StoreID,DateSold")] ProductSold productSold) { if (ModelState.IsValid) { db.Entry(productSold).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerID = new SelectList(db.Customers, "ID", "Name", productSold.CustomerID); ViewBag.ProductID = new SelectList(db.Products, "ID", "Name", productSold.ProductID); ViewBag.StoreID = new SelectList(db.Stores, "ID", "Name", productSold.StoreID); return(View(productSold)); }
public void UpdateUser(User user) { context.Entry(user).State = EntityState.Modified; }
public void DeleteContact(Contact Contact) { context.Entry(Contact).State = EntityState.Modified; }