Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "ColorID,ColorName")] Color color)
 {
     if (ModelState.IsValid)
     {
         db.Entry(color).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(color));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName,Name,City,Country,Address,ZipCode,BankAccount,CreditCard")] AspNetUser aspNetUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetUser));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "SizeID,SizeTitle,SizeContext")] Size size)
 {
     if (ModelState.IsValid)
     {
         db.Entry(size).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(size));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ShipperID,ShippName,Phone")] Shipper shipper)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipper).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(shipper));
 }
Ejemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "CategoryID,CategoryName")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Ejemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "ProductID,ProductName,CategoryID,UnitPrice")] 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));
 }
Ejemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "ImgID,PDID,ImgName")] Image image)
 {
     if (ModelState.IsValid)
     {
         db.Entry(image).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PDID = new SelectList(db.ProductDetails, "PDID", "PDID", image.PDID);
     return(View(image));
 }
Ejemplo n.º 8
0
 public ActionResult Edit([Bind(Include = "DDID,ProductID,Detail")] DesDetail desDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(desDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", desDetail.ProductID);
     return(View(desDetail));
 }
 public ActionResult Edit([Bind(Include = "DSTID,ProductID,SubTitle")] DesSubTitle desSubTitle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(desSubTitle).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", desSubTitle.ProductID);
     return View(desSubTitle);
 }
Ejemplo n.º 10
0
 public ActionResult Edit([Bind(Include = "PDID,OrderID,Price,Quantity,Discount")] OrderDetail orderDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orderDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "OrderID", orderDetail.OrderID);
     ViewBag.PDID    = new SelectList(db.ProductDetails, "PDID", "PDID", orderDetail.PDID);
     return(View(orderDetail));
 }
Ejemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "OrderID,UserID,ShippingID,RecipientName,RecipientAddressee,RecipientZipCod,RecipientCity,RecipientPhone,Payment,OrderDate,Remaeks,ShipDate")] Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID     = new SelectList(db.AspNetUsers, "Id", "Email", order.UserID);
     ViewBag.ShippingID = new SelectList(db.Shippers, "ShipperID", "ShippName", order.ShippingID);
     return(View(order));
 }
Ejemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "PDID,ProductID,Stock,SizeID,ColorID")] ProductDetail productDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ColorID   = new SelectList(db.Colors, "ColorID", "ColorName", productDetail.ColorID);
     ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", productDetail.ProductID);
     ViewBag.SizeID    = new SelectList(db.Sizes, "SizeID", "SizeContext", productDetail.SizeID);
     return(View(productDetail));
 }
Ejemplo n.º 13
0
        //[AllowAnonymous]
        public ActionResult AccountPage([Bind(Include = "Name, Email, PhoneNumber, City, Address, ZipCode")] UserViewModel model)   //帳戶主頁面
        {
            if (ModelState.IsValid)
            {
                var Userid = User.Identity.GetUserId();
                var user   = db.AspNetUsers.FirstOrDefault(x => x.Id == Userid);

                user.Name            = model.Name;
                user.Email           = model.Email;
                user.PhoneNumber     = model.PhoneNumber;
                user.City            = model.City;
                user.Address         = model.Address;
                user.ZipCode         = model.ZipCode;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("AccountPage", "Home"));
        }
Ejemplo n.º 14
0
 public void Create(T entity)
 {
     _context.Entry(entity).State = EntityState.Added;
 }