コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,Category1,Description,Active,CreateDateTime,UpdateDateTime")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Description,ImagURL,ProductId,Active,CreateDateTime,UpdateDateTime")] ProductImage productImage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productImage).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Description", productImage.ProductId);
     return View(productImage);
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Description,Model,Price,Keywords,CategoryId,Active")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Category1", product.CategoryId);
     return(View(product));
 }
コード例 #4
0
 public void Update(T obj)
 {
     table.Attach(obj);
     _context.Entry(obj).State = EntityState.Modified;
 }