// GET: Estado public ActionResult Index() { List <EstadoCLS> listaEstado = null; using (var bd = new proyectoSEntities1()) { listaEstado = (from estate in bd.pState select new EstadoCLS { iidState = estate.idState, nombreS = estate.nombreS }).ToList(); } return(View(listaEstado)); }
// GET: Rol public ActionResult Index() { List <RolCLS> listaRol = null; using (var bd = new proyectoSEntities1()) { listaRol = (from r in bd.Rol select new RolCLS { iidRol = r.idRol, nombreR = r.nombreR }).ToList(); } return(View(listaRol)); }
public ActionResult Agregar(RolCLS oRolCLS) { if (!ModelState.IsValid) { return(View(oRolCLS)); } else { using (var bd = new proyectoSEntities1()) { Rol oRol = new Rol(); oRol.nombreR = oRolCLS.nombreR; bd.Rol.Add(oRol); bd.SaveChanges(); } } return(RedirectToAction("Index")); }
// GET: Producto public ActionResult Index() { List <ProductoCLS> listaProducto = null; using (var bd = new proyectoSEntities1()) { listaProducto = (from product in bd.Producto select new ProductoCLS { iidProducto = product.idProducto, nombreP = product.nombresP, precio = (double)product.precio, coste = (double)product.coste, descripcion = product.descripcion, cantidad = (int)product.cantidad, iidState = (int)product.idState }).ToList(); } return(View(listaProducto)); }
public ActionResult Agregar(EstadoCLS oEstadoCLS) { if (!ModelState.IsValid) { return(View(oEstadoCLS)); } else { using (var bd = new proyectoSEntities1()) { pState oEstado = new pState(); oEstado.nombreS = oEstadoCLS.nombreS; bd.pState.Add(oEstado); bd.SaveChanges(); } } return(RedirectToAction("Index")); }
// GET: Cliente public ActionResult Index() { List <ClienteCLS> listaCliente = null; using (var bd = new proyectoSEntities1()) { listaCliente = (from Client in bd.Cliente select new ClienteCLS { icedula = Client.cedula, inombreC = Client.nombreC, iapellidosC = Client.apellidos, idireccion = Client.direccion, icelular = Client.celular, itelefono = Client.telefono }).ToList(); } return(View(listaCliente)); }
public ActionResult Agregar(ProductoCLS oProductoCLS) { if (!ModelState.IsValid) { return(View(oProductoCLS)); } else { using (var bd = new proyectoSEntities1()) { Producto oProducto = new Producto(); oProducto.nombresP = oProductoCLS.nombreP; oProducto.precio = (decimal?)oProductoCLS.precio; oProducto.coste = (decimal?)oProductoCLS.coste; oProducto.descripcion = oProductoCLS.descripcion; oProducto.cantidad = (int)oProductoCLS.cantidad; oProducto.idState = (int)oProductoCLS.iidState; bd.Producto.Add(oProducto); bd.SaveChanges(); } } return(RedirectToAction("Index")); }
public ActionResult Agregar(ClienteCLS oClienteCLS) { if (!ModelState.IsValid) { return(View(oClienteCLS)); } else { using (var bd = new proyectoSEntities1()) { Cliente oCliente = new Cliente(); oCliente.cedula = oClienteCLS.icedula; oCliente.nombreC = oClienteCLS.inombreC; oCliente.apellidos = oClienteCLS.iapellidosC; oCliente.direccion = oClienteCLS.idireccion; oCliente.celular = oClienteCLS.icelular; oCliente.telefono = oClienteCLS.itelefono; bd.Cliente.Add(oCliente); bd.SaveChanges(); } } return(RedirectToAction("Index")); }