public JsonResult Crear(EDProductPresentationPrice ProductoDetalle)
        {
            bool   Probar  = true;
            string Mensaje = "";
            EDProductPresentationPrice EDProductPresentationPrice = new EDProductPresentationPrice();

            EDProductPresentationPrice.PrecioProductoId = ProductoDetalle.PrecioProductoId;
            EDProductPresentationPrice.Precio           = ProductoDetalle.Precio;
            EDProductPresentationPrice.PresentationId   = ProductoDetalle.PresentationId;
            EDProductPresentationPrice.ProductDetailId  = ProductoDetalle.ProductDetailId;
            try
            {
                ProductPresentationPrice ProductPresentationPrice = new ProductPresentationPrice();
                ProductPresentationPrice.Precio          = EDProductPresentationPrice.Precio;
                ProductPresentationPrice.PresentationId  = EDProductPresentationPrice.PresentationId;
                ProductPresentationPrice.ProductDetailId = EDProductPresentationPrice.ProductDetailId;
                db.ProductPresentationPrices.Add(ProductPresentationPrice);
                db.SaveChanges();
                Mensaje = " Registro Agregado con exito.";
            }
            catch (Exception)
            {
                Probar  = false;
                Mensaje = " Se produjo un error al agregar el registro.";
            }


            return(Json(new { Probar, Mensaje }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Borrar(int ID)
        {
            bool   Probar  = true;
            string Mensaje = "";
            ProductPresentationPrice ProductPresentationPrice = db.ProductPresentationPrices.Find(ID);

            if (ProductPresentationPrice == null)
            {
                Probar  = false;
                Mensaje = " No se encuentra el registro";
            }
            else
            {
                try
                {
                    db.ProductPresentationPrices.Remove(ProductPresentationPrice);
                    db.SaveChanges();
                    Mensaje = " Registro eliminado con exito.";
                }
                catch (Exception)
                {
                    Probar  = false;
                    Mensaje = " Se produjo un error al borrar el registro.";
                }
            }

            return(Json(new { Probar, Mensaje }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ProductPresentationPrice productPresentationPrice = db.ProductPresentationPrices.Find(id);

            db.ProductPresentationPrices.Remove(productPresentationPrice);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "PrecioProductoId,Precio,PresentationId,DetailProductId")] ProductPresentationPrice productPresentationPrice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productPresentationPrice).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PresentationId = new SelectList(db.Presentations, "PresentationId", "PresentationId", productPresentationPrice.PresentationId);
     return(View(productPresentationPrice));
 }
        // GET: ProductPresentationPrices/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductPresentationPrice productPresentationPrice = db.ProductPresentationPrices.Find(id);

            if (productPresentationPrice == null)
            {
                return(HttpNotFound());
            }
            return(View(productPresentationPrice));
        }
        // GET: ProductPresentationPrices/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductPresentationPrice productPresentationPrice = db.ProductPresentationPrices.Find(id);

            if (productPresentationPrice == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PresentationId = new SelectList(db.Presentations, "PresentationId", "PresentationId", productPresentationPrice.PresentationId);
            return(View(productPresentationPrice));
        }
        public JsonResult Editar(EDProductPresentationPrice ProductoDetalle)
        {
            bool   Probar  = true;
            string Mensaje = "";
            EDProductPresentationPrice EDProductPresentationPrice = new EDProductPresentationPrice();

            EDProductPresentationPrice.PrecioProductoId = ProductoDetalle.PrecioProductoId;
            EDProductPresentationPrice.Precio           = ProductoDetalle.Precio;
            EDProductPresentationPrice.PresentationId   = ProductoDetalle.PresentationId;
            EDProductPresentationPrice.ProductDetailId  = ProductoDetalle.ProductDetailId;

            ProductPresentationPrice ProductPresentationPrice = db.ProductPresentationPrices.Find(ProductoDetalle.PrecioProductoId);

            if (ProductPresentationPrice == null)
            {
                Probar  = false;
                Mensaje = " No se encuentra el registro.";
            }
            else
            {
                try
                {
                    ProductPresentationPrice.Precio          = EDProductPresentationPrice.Precio;
                    ProductPresentationPrice.PresentationId  = EDProductPresentationPrice.PresentationId;
                    ProductPresentationPrice.ProductDetailId = EDProductPresentationPrice.ProductDetailId;
                    db.Entry(ProductPresentationPrice).State = EntityState.Modified;
                    db.SaveChanges();
                    Mensaje = " Registro modificado con exito.";
                }
                catch (Exception e)
                {
                    Probar  = false;
                    Mensaje = " Se produjo un error al modificar el registro.";
                }
            }

            return(Json(new { Probar, Mensaje }, JsonRequestBehavior.AllowGet));
        }