コード例 #1
0
 public ActionResult Edit([Bind(Include = "StoreId,StoreName,StoreAddress,StoreCity,StoreState,StoreZipCode,IsSelected")] Store store)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(store));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "CustomerId,CFirstName,CLastName,CAddress,CCity,CState,CZipCode")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "CategoryId,CategoryName,Desription")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "ListId,CustomerId,ListDate")] List list)
 {
     if (ModelState.IsValid)
     {
         db.Entry(list).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "CFirstName", list.CustomerId);
     return(View(list));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "ProductId,ProductName,CategoryId,IsSelected,Price,Quantity")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", product.CategoryId);
     return(View(product));
 }
コード例 #6
0
        public ActionResult Edit(staff IdToEdit)
        {
            var orignalRecord = (from m in obj.staffs where m.id == IdToEdit.id select m).First();

            if (!ModelState.IsValid)
            {
                return(View(orignalRecord));
            }
            obj.Entry(orignalRecord).CurrentValues.SetValues(IdToEdit);

            obj.SaveChanges();
            return(RedirectToAction("StaffDetails"));
        }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "ListId,ProductId,StoreId,ListDetailsId")] ListDetail listDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(listDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create"));
     }
     ViewBag.ListId    = new SelectList(db.Lists, "ListId", "ListId", listDetail.ListId);
     ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", listDetail.ProductId);
     ViewBag.StoreId   = new SelectList(db.Stores, "StoreId", "StoreName", listDetail.StoreId);
     return(View(listDetail));
 }