public ActionResult Create([Bind(Include = "IDARCHIVO,IDTIPO,NOMBREARCHIVO,FECHA,ESTATUS")] ARCHIVOS aRCHIVOS, HttpPostedFileBase ARCHIVO, HttpPostedFileBase IMAGENARCHIVO) { int idUsuario = Convert.ToInt32(Session["IDUSUARIO"]); // if (IMAGENARCHIVO != null) { aRCHIVOS.IMAGENARCHIVO = new byte[IMAGENARCHIVO.ContentLength]; IMAGENARCHIVO.InputStream.Read(aRCHIVOS.IMAGENARCHIVO, 0, IMAGENARCHIVO.ContentLength); } if (ARCHIVO != null) { aRCHIVOS.ARCHIVO = new byte[ARCHIVO.ContentLength]; ARCHIVO.InputStream.Read(aRCHIVOS.ARCHIVO, 0, ARCHIVO.ContentLength); } if (ModelState.IsValid) { db.ARCHIVOS.Add(aRCHIVOS); aRCHIVOS.FECHA = DateTime.Now; aRCHIVOS.ESTATUS = "A"; db.SaveChanges(); return(RedirectToAction("ControlArchivos")); } ViewBag.IDTIPO = new SelectList(db.TIPO_PLANTILLA.Where(s => s.IDTIPO >= 6), "IDTIPO", "TIPOPLANTILLA"); return(View(aRCHIVOS)); }
public ActionResult Create([Bind(Include = "IDUSUARIO,USUARIOINICIA,CONTRASENA,NOMBREUSUARIO,ROL,ESTATUS,FECHAREGISTRO,CORREO")] USUARIO uSUARIO) { if (ModelState.IsValid) { db.USUARIO.Add(uSUARIO); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(uSUARIO)); }
public ActionResult Create([Bind(Include = "IDPLANTILLA,IDUSUARIO,IDTIPO,TITULO,CONTENIDO")] PLANTILLA pLANTILLA) { int idUsuario = Convert.ToInt32(Session["IDUSUARIO"]); if (ModelState.IsValid) { pLANTILLA.IDUSUARIO = idUsuario; db.PLANTILLA.Add(pLANTILLA); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IDTIPO = new SelectList(db.TIPO_PLANTILLA, "IDTIPO", "TIPOPLANTILLA", pLANTILLA.IDTIPO); ViewBag.IDUSUARIO = new SelectList(db.USUARIO, "IDUSUARIO", "USUARIOINICIA", pLANTILLA.IDUSUARIO); return(View(pLANTILLA)); }
public ActionResult CrearNoticias([Bind(Include = "IDNOTICIA,IDUSUARIO,TITULO,CONTENIDO,FECHACAPTURA,FECHAPUBLIC,LUGAR,PRIORIDAD,ESTATUS")] NOTICIAS_SEPLAN Noticias_Seplan) { int idUsuario = Convert.ToInt32(Session["IDUSUARIO"]); if (ModelState.IsValid) { Noticias_Seplan.IDUSUARIO = idUsuario; Noticias_Seplan.FECHACAPTURA = DateTime.Now; Noticias_Seplan.ESTATUS = "A"; db.NOTICIAS.Add(Noticias_Seplan); db.SaveChanges(); return(RedirectToAction("ListaNoticias")); } ViewBag.IDUSUARIO = new SelectList(db.USUARIO, "IDUSUARIO", "USUARIOINICIA", Noticias_Seplan.IDUSUARIO); return(View(Noticias_Seplan)); }
public ActionResult EditarNoticiasAdmin([Bind(Include = "IDNOTICIA,IDUSUARIO,TITULO,CONTENIDO,FECHACAPTURA,FECHAPUBLIC,LUGAR,PRIORIDAD,ESTATUS")] NOTICIAS_SEPLAN Noticias_Seplan) { //hay que agregar todos los campos en el bind y los idnoticia, idusuario, estatus, fechacaptura hay que colocarlos //dentro de un hidden sino este desgraciado segmento marca una excepción if (ModelState.IsValid) { db.Entry(Noticias_Seplan).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ListaNoticiasAdmin")); } ViewBag.IDNOTICIA = new SelectList(db.FOTOS, "IDNOTICIA", "IDNOTICIA", Noticias_Seplan.IDNOTICIA); return(View(Noticias_Seplan)); }