Función "index" (Primer Pedido, no da problemas, bloquea el pedido hasta que se totalice o cancele)
Código:
Función "secundario" (Donde no me funciona el bloqueo, y cada vez que ingreso pide generar un nuevo pedido)[AuthorizeRoles(Modulo = "4310")] public ActionResult Index() { /* Lot of Code Here */ var pedido_1 = dc.SAFACTs.FirstOrDefault(b => b.CodUsua == User.Identity.Name && b.SAFACT_01.Estado == "0"); if (pedido_1 != null) { Session["pedido1"] = pedido_1; /* Lot of Code Here */ } /* If order "pedido1" does not exist, we create a new order */ return View(pedido_1); //Load the view with the data and here works the lock. View Data with the data of pedido_1 until the user totalize or cancel this order }
Código:
Gracias de antemano, cualquier ayuda es muy apreciada AuthorizeRoles(Modulo = "4310")] public ActionResult secundario() { if (Session["pedido1"] != null) //I check if the first order "pedido1" exists, if exists i do the second order { /* Lot of Code Here */ var pedido_2 = dc.SAFACTs.Skip(1).Take(1).FirstOrDefault(b => b.CodUsua == User.Identity.Name && b.SAFACT_01.Estado == "0"); if (Session["pedido2"] != null) { pedido_2 = (PRINCIPAL.Areas.VENTAS.Models.SAFACT)Session["pedido2"]; //Session["pedido2"] = pedido_2; } if (pedido_2 != null) { /* Lot of Code Here */ } /* If order "pedido2" does not exist, we create a new order */ return View(pedido_2); /* Load the view with the data and here DOES NOT work the lock and i can make n orders I should View Data with the data of pedido_2 until the user totalize or cancel this order */ } else // If first order "pedido1" does not exist i redirect the user to index function { return RedirectToAction("Index", "PROG_4310"); //Redirect to Index } }