public ActionResult Create(PRD_ProductosDetalles prd_productosdetalles) { if (Session["prodid"] != null) prd_productosdetalles.PRO_Id = int.Parse(Session["prodid"].ToString()); if (ModelState.IsValid) { db.PRD_ProductosDetalles.Add(prd_productosdetalles); db.SaveChanges(); if (Request.IsAjaxRequest()) { return Json(new { redirectToUrl = Url.Action("Index", "ProductDetails", new { prod = prd_productosdetalles.PRO_Id }) }); } return RedirectToAction("Index", "ProductDetails", new { prod = prd_productosdetalles.PRO_Id }); } else { throw new Exception("La operación no ha sido completada"); } return View(prd_productosdetalles); }
public ActionResult Edit(PRD_ProductosDetalles prd_productosdetalles) { if (ModelState.IsValid) { db.Entry(prd_productosdetalles).State = EntityState.Modified; db.SaveChanges(); if (Request.IsAjaxRequest()) { return Json(new { redirectToUrl = Url.Action("Index","ProductDetails", new { prod = prd_productosdetalles.PRO_Id }) }); } return RedirectToAction("Index"); } else { throw new Exception("La operación no ha sido completada"); } return View(prd_productosdetalles); }