Exemple #1
0
        public ActionResult Edit(Order order, int Deliver_Status)
        {
            if (ModelState.IsValid)
            {
                order = db.Orders.Find(order.Order_ID);
                order.Order_ChangeDate = DateTime.Now;
                order.Deliver_Status   = Deliver_Status;
                db.Entry(order).State  = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            ViewBag.DS = new SelectList(
                new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Đang xử lý", Value = "1"
                },
                new SelectListItem {
                    Text = "Đã tiếp nhận", Value = "2"
                },
                new SelectListItem {
                    Text = "Đang vận chuyển", Value = "3"
                },
                new SelectListItem {
                    Text = "Đã giao hàng", Value = "4"
                }
            }, "Value", "Text");

            return(View(order));
        }
        public ActionResult Edit([Bind(Include = "Contact_ID,Customer_Name,Phone,Email,Address,Status")] Contact contact, int Status, string Feedback_Reply)
        {
            if (ModelState.IsValid)
            {
                contact        = db.Contacts.Find(contact.Contact_ID);
                contact.Status = Status;

                db.Entry(contact).State = EntityState.Modified;
                ContactsDetail contd = db.ContactsDetails.Find(contact.Contact_ID);
                contd.Feedback_Reply  = Feedback_Reply;
                contd.Date            = DateTime.Now;
                db.Entry(contd).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.DS = new SelectList(
                new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Chưa xử lý", Value = "1"
                },
                new SelectListItem {
                    Text = "Đã xử lý", Value = "2"
                }
            }, "Value", "Text");
            return(View(contact));
        }
        public ActionResult Edit(ProductTable producttable)
        {
            ValidateClock(producttable);
            if (ModelState.IsValid)
            {
                using (var scope = new TransactionScope())
                {
                    // add model to database
                    db.Entry(producttable).State = EntityState.Modified;
                    db.SaveChanges();
                    // save file to app_data
                    var path = Server.MapPath("~/App_Data");
                    path = System.IO.Path.Combine(path, producttable.Watch_ID.ToString());

                    if (Request.Files["Image"].ContentLength != 0)

                    {
                        Request.Files["Image"].SaveAs(path + "_0");
                    }
                    if (Request.Files["Image1"].ContentLength != 0)
                    {
                        Request.Files["Image1"].SaveAs(path + "_1");
                    }
                    if (Request.Files["Image2"].ContentLength != 0)
                    {
                        Request.Files["Image2"].SaveAs(path + "_2");
                    }
                    // all done successfully
                    scope.Complete();
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.WatchType_ID = new SelectList(db.ProductTypes, "ProductType_ID", "ProductType_Name", producttable.WatchType_ID);
            return(View("Edit", producttable));
        }
 public ActionResult Edit([Bind(Include = "Contact_ID,Customer_Name,Phone,Email,Address,Status")] Contact contact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contact));
 }