public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ProductContainerBuyerPrice productContainerBuyerPrice = await db.ProductContainerBuyerPrices.FindAsync(id);

            db.ProductContainerBuyerPrices.Remove(productContainerBuyerPrice);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        // GET: ProductContainerBuyerPrices/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductContainerBuyerPrice productContainerBuyerPrice = await db.ProductContainerBuyerPrices.FindAsync(id);

            if (productContainerBuyerPrice == null)
            {
                return(HttpNotFound());
            }
            return(View(productContainerBuyerPrice));
        }
        public async Task <ActionResult> Create([Bind(Include = "ProductContainerBuyerPriceID,ProductID,ContainerID,BuyerID,Unit,Price")] ProductContainerBuyerPrice productContainerBuyerPrice)
        {
            if (ModelState.IsValid)
            {
                db.ProductContainerBuyerPrices.Add(productContainerBuyerPrice);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.BuyerID     = new SelectList(db.Buyers, "BuyerID", "BuyerCode", productContainerBuyerPrice.BuyerID);
            ViewBag.ContainerID = new SelectList(db.Containers, "ContainerID", "ContainerNumber", productContainerBuyerPrice.ContainerID);
            ViewBag.ProductID   = new SelectList(db.Products, "ProductID", "ProductCode", productContainerBuyerPrice.ProductID);
            return(View(productContainerBuyerPrice));
        }
Ejemplo n.º 4
0
 public async Task Edit([Bind(Include = "ProductContainerBuyerPriceID,ProductID,ContainerID,BuyerID,Unit,Price")] ProductContainerBuyerPrice productContainerBuyerPrice)
 {
     productContainerBuyerPrice.ContainerID = CurrentContainerID;
     if (ModelState.IsValid)
     {
         if (productContainerBuyerPrice.ProductContainerBuyerPriceID == 0)
         {
             db.ProductContainerBuyerPrices.Add(productContainerBuyerPrice);
         }
         else
         {
             db.Entry(productContainerBuyerPrice).State = EntityState.Modified;
         }
         await db.SaveChangesAsync();
     }
 }
        // GET: ProductContainerBuyerPrices/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductContainerBuyerPrice productContainerBuyerPrice = await db.ProductContainerBuyerPrices.FindAsync(id);

            if (productContainerBuyerPrice == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BuyerID     = new SelectList(db.Buyers, "BuyerID", "BuyerCode", productContainerBuyerPrice.BuyerID);
            ViewBag.ContainerID = new SelectList(db.Containers, "ContainerID", "ContainerNumber", productContainerBuyerPrice.ContainerID);
            ViewBag.ProductID   = new SelectList(db.Products, "ProductID", "ProductCode", productContainerBuyerPrice.ProductID);
            return(View(productContainerBuyerPrice));
        }