Exemple #1
0
 public ActionResult Edit([Bind(Include = "userId,orderId,cardNumber,Active")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
 public ActionResult Edit([Bind(Include = "productId,name,price,originalPrice,description,stockLevel,Active")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
 public ActionResult Edit([Bind(Include = "Id, name, unitPrice, discount, units, pictureUrl")] OrderItem item)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(item).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(item));
     }
     catch
     {
         return(View());
     }
 }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "Id, HolderName, CardNumber,CardExpiration, SecurityNumber")] Card card)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(card).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(card));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit([Bind(Include = "Id, OrderDate, Status, Total, description, OrderItems, street, postCode, Country, OrderCard")] Order order)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(order).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(order));
     }
     catch
     {
         return(View());
     }
 }
 //update order
 public void UpdateOrder(Order order)
 {
     context.Entry(order).State = EntityState.Modified;
 }