예제 #1
0
        public ActionResult Edit(ManufacturerProductViewModel manufacturerProductVM)
        {
            using (GoodSupplyEntities db = new GoodSupplyEntities())
            {
                var manufacturerProducts = new ManufacturerProducts
                {
                    Id              = manufacturerProductVM.ManufacturerProducts.Id,
                    Name            = manufacturerProductVM.ManufacturerProducts.Name,
                    CatalogNumber   = manufacturerProductVM.ManufacturerProducts.CatalogNumber,
                    ImageUrl        = manufacturerProductVM.ManufacturerProducts.ImageUrl,
                    PackageQuantity = manufacturerProductVM.ManufacturerProducts.PackageQuantity,
                    Width           = manufacturerProductVM.ManufacturerProducts.Width,
                    Length          = manufacturerProductVM.ManufacturerProducts.Length,
                    Height          = manufacturerProductVM.ManufacturerProducts.Height,
                    Manufacturers   = manufacturerProductVM.ManufacturerProducts.Manufacturers,
                    ManufacturerId  = manufacturerProductVM.ManufacturerProducts.ManufacturerId,
                    Products        = manufacturerProductVM.ManufacturerProducts.Products,
                    ProductId       = manufacturerProductVM.ManufacturerProducts.ProductId
                };

                if (ModelState.IsValid)
                {
                    db.Entry(manufacturerProducts).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                manufacturerProductVM.Manufacturers = db.Manufacturers.ToList();
                manufacturerProductVM.Products      = db.Products.ToList();
                return(View(manufacturerProductVM));
            }
        }
예제 #2
0
        public ActionResult Edit(OrderDetailViewModel orderDetailVM)
        {
            using (GoodSupplyEntities db = new GoodSupplyEntities())
            {
                var orderDetails = new OrderDetails
                {
                    Id                    = orderDetailVM.OrderDetails.Id,
                    Quantity              = orderDetailVM.OrderDetails.Quantity,
                    QuantityPrice         = orderDetailVM.OrderDetails.QuantityPrice,
                    ItemPrice             = orderDetailVM.OrderDetails.ItemPrice,
                    TotalOrderPrice       = orderDetailVM.OrderDetails.TotalOrderPrice,
                    OrderId               = orderDetailVM.OrderDetails.OrderId,
                    Orders                = orderDetailVM.OrderDetails.Orders,
                    ManufacturerProductId = orderDetailVM.OrderDetails.ManufacturerProductId,
                    ManufacturerProducts  = orderDetailVM.OrderDetails.ManufacturerProducts
                };

                if (ModelState.IsValid)
                {
                    db.Entry(orderDetails).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                orderDetailVM.ManufacturerProducts = db.ManufacturerProducts.ToList();
                orderDetailVM.Orders = db.Orders.ToList();
                return(View(orderDetailVM));
            }
        }
예제 #3
0
        public ActionResult Edit(OrderViewModel orderVM)
        {
            var orders = new Orders
            {
                Id               = orderVM.Orders.Id,
                CreateDate       = orderVM.Orders.CreateDate,
                PayDate          = orderVM.Orders.PayDate,
                Discount         = orderVM.Orders.Discount,
                TotalPrice       = orderVM.Orders.TotalPrice,
                ClientApproval   = orderVM.Orders.ClientApproval,
                SupplierApproval = orderVM.Orders.SupplierApproval,
                ClientId         = orderVM.Orders.ClientId,
                Clients          = orderVM.Orders.Clients,
                SupplierId       = orderVM.Orders.SupplierId,
                Suppliers        = orderVM.Orders.Suppliers
            };

            if (ModelState.IsValid)
            {
                db.Entry(orders).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            orderVM.Suppliers = db.Suppliers.ToList();
            orderVM.Clients   = db.Clients.ToList();
            return(View(orderVM));
        }
        public ActionResult Edit(PriceViewModel priceVM)
        {
            using (GoodSupplyEntities db = new GoodSupplyEntities())
            {
                var prices = new Prices
                {
                    Id = priceVM.Prices.Id,
                    ManufacturerPrice     = priceVM.Prices.ManufacturerPrice,
                    ProductPrice          = priceVM.Prices.ProductPrice,
                    Quantity              = priceVM.Prices.Quantity,
                    ManufacturerProductId = priceVM.Prices.ManufacturerProductId,
                    ManufacturerProducts  = priceVM.Prices.ManufacturerProducts,
                    SupplierId            = priceVM.Prices.SupplierId,
                    Suppliers             = priceVM.Prices.Suppliers
                };

                if (ModelState.IsValid)
                {
                    db.Entry(prices).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                priceVM.ManufacturerProducts = db.ManufacturerProducts.ToList();
                priceVM.Suppliers            = db.Suppliers.ToList();
                return(View(priceVM));
            }
        }
예제 #5
0
 public ActionResult Edit(Manufacturers manufacturers)
 {
     using (GoodSupplyEntities db = new GoodSupplyEntities())
     {
         if (ModelState.IsValid)
         {
             db.Entry(manufacturers).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(manufacturers));
     }
 }
예제 #6
0
        public ActionResult Edit(ProductViewModel productVM)
        {
            var products = new Products
            {
                Id         = productVM.Products.Id,
                Name       = productVM.Products.Name,
                Categories = productVM.Products.Categories,
                CategoryId = productVM.Products.CategoryId
            };

            using (GoodSupplyEntities db = new GoodSupplyEntities())
            {
                if (ModelState.IsValid)
                {
                    db.Entry(products).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                productVM.Categories = db.Categories.ToList();
                return(View(productVM));
            }
        }
예제 #7
0
        public ActionResult Edit(CategoryViewModel categoryVM)
        {
            var categories = new Categories
            {
                Id       = categoryVM.Categories.Id,
                Name     = categoryVM.Categories.Name,
                Parents  = categoryVM.Categories.Parents,
                ParentId = categoryVM.Categories.ParentId
            };

            using (GoodSupplyEntities db = new GoodSupplyEntities())
            {
                //var categoryInDb = db.Categories.Single(c => c.Id == categoryVM.Categories.Id);

                if (ModelState.IsValid)
                {
                    db.Entry(categories).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                categoryVM.CategoriesList = db.Categories.ToList();
                return(View(categoryVM));
            }
        }