// GET: Consoporte/Details/5 public ActionResult Details(string tsol, string tsopo) { int pagina_id = 843; //ID EN BASE DE DATOS FnCommon.ObtenerConfPage(db, pagina_id, User.Identity.Name, this.ControllerContext.Controller); try { string p = Session["pais"].ToString(); ViewBag.pais = p + ".svg"; } catch { //return RedirectToAction("Pais", "Home"); } if (tsol == null || tsopo == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CONSOPORTE cONSOPORTE = db.CONSOPORTEs.Include(c => c.TSOL.TSOLTs).Include(c => c.TSOPORTE.TSOPORTETs).Where(x => x.TSOL_ID == tsol && x.TSOPORTE_ID == tsopo).First(); if (cONSOPORTE == null) { return(HttpNotFound()); } return(View(cONSOPORTE)); }
// GET: Consoporte/Delete/5 //public ActionResult Delete(string id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // CONSOPORTE cONSOPORTE = db.CONSOPORTEs.Find(id); // if (cONSOPORTE == null) // { // return HttpNotFound(); // } // return View(cONSOPORTE); //} // POST: Consoporte/Delete/5 //[HttpPost, ActionName("Delete")] //[ValidateAntiForgeryToken] public ActionResult Delete(string tsol, string tsopo) { CONSOPORTE cONSOPORTE = db.CONSOPORTEs.Where(x => x.TSOL_ID == tsol && x.TSOPORTE_ID == tsopo).First(); db.CONSOPORTEs.Remove(cONSOPORTE); db.SaveChanges(); return(RedirectToAction("Index", new { tsol = cONSOPORTE.TSOL_ID })); }
public ActionResult Edit([Bind(Include = "TSOL_ID,TSOPORTE_ID,OBLIGATORIO,ACTIVO")] CONSOPORTE cONSOPORTE) { if (ModelState.IsValid) { db.Entry(cONSOPORTE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } cONSOPORTE = db.CONSOPORTEs.Include(c => c.TSOL.TSOLTs).Include(c => c.TSOPORTE.TSOPORTETs).Where(x => x.TSOL_ID == cONSOPORTE.TSOL_ID && x.TSOPORTE_ID == cONSOPORTE.TSOPORTE_ID).First(); return(View(cONSOPORTE)); }
public ActionResult Edit([Bind(Include = "TSOL_ID,TSOPORTE_ID,OBLIGATORIO,ACTIVO")] CONSOPORTE cONSOPORTE) { if (ModelState.IsValid) { cONSOPORTE.ACTIVO = true; db.Entry(cONSOPORTE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { tsol = cONSOPORTE.TSOL_ID })); } ViewBag.TSOL_ID = new SelectList(db.TSOLs, "ID", "DESCRIPCION", cONSOPORTE.TSOL_ID); ViewBag.TSOPORTE_ID = new SelectList(db.TSOPORTEs, "ID", "DESCRIPCION", cONSOPORTE.TSOPORTE_ID); return(View(cONSOPORTE.TSOL_ID, cONSOPORTE.TSOPORTE_ID)); }
// GET: Consoporte/Edit/5 public ActionResult Edit(string tsol, string tsopo) { int pagina = 843; //ID EN BASE DE DATOS string u = User.Identity.Name; var user = db.USUARIOs.Where(a => a.ID.Equals(u)).FirstOrDefault(); ViewBag.permisos = db.PAGINAVs.Where(a => a.ID.Equals(user.ID)).ToList(); ViewBag.carpetas = db.CARPETAVs.Where(a => a.USUARIO_ID.Equals(user.ID)).ToList(); ViewBag.usuario = user; ViewBag.rol = user.PUESTO.PUESTOTs.Where(a => a.SPRAS_ID.Equals(user.SPRAS_ID)).FirstOrDefault().TXT50; ViewBag.Title = db.PAGINAs.Where(a => a.ID.Equals(844)).FirstOrDefault().PAGINATs.Where(b => b.SPRAS_ID.Equals(user.SPRAS_ID) && b.ID == 844).FirstOrDefault().TXT50; ViewBag.warnings = db.WARNINGVs.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList(); ViewBag.textos = db.TEXTOes.Where(a => (a.PAGINA_ID.Equals(pagina) || a.PAGINA_ID.Equals(0)) && a.SPRAS_ID.Equals(user.SPRAS_ID)).ToList(); ViewBag.IdTsol = tsol; ViewBag.activo = true; try { string p = Session["pais"].ToString(); ViewBag.pais = p + ".svg"; } catch { //return RedirectToAction("Pais", "Home"); } Session["spras"] = user.SPRAS_ID; if (tsol == null | tsopo == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CONSOPORTE cONSOPORTE = db.CONSOPORTEs.Where(x => x.TSOL_ID == tsol && x.TSOPORTE_ID == tsopo).First(); if (cONSOPORTE == null) { return(HttpNotFound()); } ViewBag.TSOL_ID = new SelectList(db.TSOLs, "ID", "DESCRIPCION", cONSOPORTE.TSOL_ID); ViewBag.TSOPORTE_ID = new SelectList(db.TSOPORTEs, "ID", "DESCRIPCION", cONSOPORTE.TSOPORTE_ID); return(View(cONSOPORTE)); }
// GET: Consoporte/Create public ActionResult Create() { int pagina_id = 843; //ID EN BASE DE DATOS FnCommon.ObtenerConfPage(db, pagina_id, User.Identity.Name, this.ControllerContext.Controller); try { string p = Session["pais"].ToString(); ViewBag.pais = p + ".svg"; } catch { //return RedirectToAction("Pais", "Home"); } CONSOPORTE consoporte = new CONSOPORTE { ACTIVO = true, OBLIGATORIO = true }; return(View(consoporte)); }
public ActionResult Create([Bind(Include = "TSOL_ID,TSOPORTE_ID,OBLIGATORIO,ACTIVO")] CONSOPORTE cONSOPORTE) { if (ModelState.IsValid) { if (db.CONSOPORTEs.Any(x => x.TSOPORTE_ID == cONSOPORTE.TSOPORTE_ID && x.TSOL_ID == cONSOPORTE.TSOL_ID)) { CONSOPORTE cONSOPORTEAux = db.CONSOPORTEs.First(x => x.TSOPORTE_ID == cONSOPORTE.TSOPORTE_ID && x.TSOL_ID == cONSOPORTE.TSOL_ID); cONSOPORTEAux.ACTIVO = cONSOPORTE.ACTIVO; cONSOPORTEAux.OBLIGATORIO = cONSOPORTE.OBLIGATORIO; db.Entry(cONSOPORTEAux).State = EntityState.Modified; } else { db.CONSOPORTEs.Add(cONSOPORTE); } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TSOL_ID = new SelectList(db.TSOLs, "ID", "DESCRIPCION", cONSOPORTE.TSOL_ID); ViewBag.TSOPORTE_ID = new SelectList(db.TSOPORTEs, "ID", "DESCRIPCION", cONSOPORTE.TSOPORTE_ID); return(View(cONSOPORTE)); }