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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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); }
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)); }
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)); }
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)); }
//[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")); }
public void Create(T entity) { _context.Entry(entity).State = EntityState.Added; }