예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ProductHolding productHoldings = db.ProductHoldings.Find(id);

            db.ProductHoldings.Remove(productHoldings);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "ProductID,Quantity,ReorderLevel")] ProductHolding productHoldings)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productHoldings).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(productHoldings));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "ProductID,Quantity,ReorderLevel")] ProductHolding productHoldings)
        {
            if (ModelState.IsValid)
            {
                db.ProductHoldings.Add(productHoldings);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productHoldings));
        }
예제 #4
0
        // GET: ProductHoldings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductHolding productHoldings = db.ProductHoldings.Find(id);

            if (productHoldings == null)
            {
                return(HttpNotFound());
            }
            return(View(productHoldings));
        }
예제 #5
0
        public Validation AddInclude(Product product)
        {
            ProductHolding ph = new ProductHolding
            {
                ProductHoldingID = product.ProductID,
                Quantity         = 0,
                ReorderLevel     = 1
            };

            product.ProductHolding = ph;
            var validation = this.Add(product);

            return(validation);
        }