public ActionResult Edit([Bind(Include = "OrderId,ClientId,OrderDate,OrderTotal,OrderStatus")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClientId = new SelectList(db.Client, "ClientId", "FirstName", order.ClientId); return(View(order)); }
public ActionResult Edit([Bind(Include = "ClientId,FirstName,MiddleName,LastName,Gender,DateOfBirth,CreditRating,XCode,OccupationId,TelephoneNumber,Street1,Street2,City,ZipCode,Longitude,Latitude,Notes")] Client client) { if (ModelState.IsValid) { db.Entry(client).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OccupationId = new SelectList(db.Occupation, "OccupationId", "OccupationName", client.OccupationId); return(View(client)); }
public ActionResult Edit([Bind(Include = "OrderId,LineNumber,ProductId,Qty,LineTotal")] OrderLine orderLine) { if (ModelState.IsValid) { db.Entry(orderLine).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Orders, "OrderId", "OrderStatus", orderLine.OrderId); ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", orderLine.ProductId); return(View(orderLine)); }
public ActionResult Edit(int id) { Product product = db.Product.Find(id); if (TryUpdateModel(product, new string[] { "Price", "Active", "Stock" })) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult Edit( int id //[Bind(Include = "ProductId,ProductName,Price,Active,Stock")] Product product ) { var product = db.Product.Find(id); if (TryUpdateModel(product, new string[] { "ProductId", "Price", "Active", "Stock" })) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }