예제 #1
0
 public ActionResult CompraDetalle()
 {
     var Lista = db.d_compra.Select(p => p.m_compra.id).Take(1);
     List<m_compra> Lista2 = db.m_compra.Include(p => p.d_compra).Where(p => Lista.Contains(p.id)).ToList();
     M_M_Compra MMC = new M_M_Compra();
     MMC.LMC = Lista2;
     return View(MMC);
 }
예제 #2
0
        public ActionResult Index(M_M_Compra MMC)
        {
            m_compra MC = new m_compra();
            MC.fecha_compra = DateTime.Today;
            MC.PROVEEDOR_id = MMC.proveedor;
            MC.total_compra = 0;
            MC.EMPLEADO_id = Convert.ToInt16(Session["Empleado_id"]);
            MC.TIPO_COMPRA_id = 1;

            db.m_compra.Add(MC);
            db.SaveChanges();

            int MASTER = Convert.ToInt16(db.m_compra.Max(x => x.id));
            Session["M_C"] = MASTER;

            return RedirectToAction("Create");
        }
예제 #3
0
 //
 // GET: /Compra/
 public ActionResult Index()
 {
     //int rol = Convert.ToInt16(Session["Rol_id"]);
     //bool Validacion = SEG.ValidarAcceso(rol, "Compra", "Index");
     //if (Validacion)
     //{
         Session["M_C"] = null;
         ViewBag.PROVEEDOR_id = new SelectList(db.proveedor, "id", "nombre");
         var Lista = db.d_compra.Select(p => p.m_compra.id).Take(1);
         List<m_compra> Lista2 = db.m_compra.Include(p => p.d_compra).Where(p => Lista.Contains(p.id)).ToList();
         M_M_Compra MMC = new M_M_Compra();
         MMC.LMC = Lista2;
         return View(MMC);
     // }
     //else
     //{
     //    return RedirectToAction("Error");
     //}
 }