コード例 #1
0
        public ActionResult Edit(Order order)
        {
            if (ModelState.IsValid)
            {
                var oldorder = db.Orders.Find(order.OrderID);
                oldorder.CustomerID      = order.CustomerID;
                db.Entry(oldorder).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("index", "ProductsOrders", new { id = order.OrderID }));
            }


            LoadDD(order.CustomerID, 0);
            return(View(order));
        }
コード例 #2
0
        public ActionResult Edit(Customer customer)
        {
            try
            {
                // TODO: Add update logic here
                var oldcustomer = db.Customers.Find(customer.CustomerID);
                oldcustomer.UserInfo.FullName = customer.UserInfo.FullName;
                oldcustomer.Notes             = customer.Notes;
                oldcustomer.PhoneNumber       = customer.PhoneNumber;

                db.Entry(oldcustomer).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                _App.ui.Message.SuccessUpdate();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #3
0
        public ActionResult Edit(Product p)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(p).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    _App.ui.Message.SuccessUpdate();
                    return(RedirectToAction("Index"));
                }

                _App.ui.Message.addError("Invalid data !");
                ViewBag.ProductCategoryID = new SelectList(db.ProductCategories, "CategoryID", "CategoryName");
                return(View(p));
            }
            catch
            {
                return(View());
            }
        }
コード例 #4
0
        public ActionResult Edit(ProductsOrder product)
        {
            try
            {
                // TODO: Add update logic here
                var old = db.ProductsOrders.Find(product.POID);
                old.ProductID       = product.ProductID;
                old.Price           = product.Price;
                old.Qantaty         = product.Qantaty;
                old.CosePrice       = product.CosePrice;
                old.Notes           = product.Notes;
                db.Entry(old).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                _App.ui.Message.SuccessUpdate();
                return(RedirectToAction("Index", new { id = product.OrderID }));
            }
            catch
            {
                return(View());
            }
        }