예제 #1
0
 public ActionResult Edit([Bind(Include = "Id,Name")] 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,Name,CategoryId,BrandId,Description,Image,Quantity,Price")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BrandId    = new SelectList(db.Brands, "Id", "Name", product.BrandId);
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", product.CategoryId);
     return(View(product));
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "Id,ProductId,BuyerId,Date,Price")] PurchaseHistory purchasehistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(purchasehistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", purchasehistory.ProductId);
     ViewBag.BuyerId   = new SelectList(db.Users, "Id", "Username", purchasehistory.BuyerId);
     return(View(purchasehistory));
 }
예제 #4
0
 public void Update(TEntity entity)
 {
     mmContext.Entry(entity).State = EntityState.Modified;
 }