public JsonResult Edit([Bind(Include = "Id,Name,Adress")] Shop shop) { if (ModelState.IsValid) { db.Entry(shop).State = EntityState.Modified; db.SaveChanges(); return(Json(true)); } return(Json(false)); }
public ActionResult Edit([Bind(Include = "ID,CreatedDate,Vendor,VendorAddress,Payment,Ship")] PurchaseOrder purchaseOrder) { if (ModelState.IsValid) { db.Entry(purchaseOrder).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(purchaseOrder)); }
public ActionResult Edit([Bind(Include = "ID,UserName,Password,GroupID,Name,Address,Email,Phone,ProvinceID,DistrictID,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy,Status,roleID,img")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "ID,Name,MetaTitle,ParentID,DisplayOrder,SeoTitle,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy,MetaKeywords,MetaDescriptions,Status,ShowOnHome")] ProductCategory productCategory) { if (ModelState.IsValid) { SetViewBag(productCategory.ParentID); db.Entry(productCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productCategory)); }
public ActionResult Edit([Bind(Include = "ID,Name,Code,MetaTitle,Description,Image,MoreImages,Price,PromotionPrice,IncludedVAT,Quantity,CategoryID,Detail,Warranty,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy,MetaKeywords,MetaDescriptions,Status,TopHot,ViewCount")] Product product) { SetViewBag(product.CategoryID); if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
//[ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "Id,Name,Specification,Price,ShopId")] Item item) { if (ModelState.IsValid) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ShopId = new SelectList(db.Shops, "Id", "Name", item.ShopId); return(View(item)); }
public ActionResult EditModel([Bind(Include = "ID,Text,Link,DisplayOder,Target,Tatus,TypeID")] Menu Model) { try { if (ModelState.IsValid) { db.Entry(Model).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { throw; } return(RedirectToAction("Index")); }
public ActionResult Edit(Product product, HttpPostedFileBase image1, HttpPostedFileBase image2) { if (ModelState.IsValid) { //var product1 = _db.Entry(product).OriginalValues; if (image1 != null) { product.Image = new byte[image1.ContentLength]; image1.InputStream.Read(product.Image, 0, image1.ContentLength); } if (image2 != null) { product.ImageSmall = new byte[image2.ContentLength]; image2.InputStream.Read(product.ImageSmall, 0, image2.ContentLength); } _db.Entry(product).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public void DeleteProduct(Product product) { db.Entry(product).State = EntityState.Deleted; db.Products.Remove(product); db.SaveChanges(); }