public ActionResult Edit([Bind(Include = "ID_precondicionTOC,Codigo,Nombre,Descripcion,Activo,ID_resultado")] Tb_PrecondicionesTOC tb_PrecondicionesTOC) { try { db.Entry(tb_PrecondicionesTOC).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(RedirectToAction("Index")); } }
// GET: PrecondicionesTOC/Delete/5 public ActionResult Delete(int id) { try { Tb_PrecondicionesTOC tb_PrecondicionesTOC = db.Tb_PrecondicionesTOC.Find(id); db.Tb_PrecondicionesTOC.Remove(tb_PrecondicionesTOC); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(RedirectToAction("Index")); } }
public ActionResult Create([Bind(Include = "ID_precondicionTOC,Codigo,Nombre,Descripcion,Activo,ID_resultado")] Tb_PrecondicionesTOC tb_PrecondicionesTOC) { try { tb_PrecondicionesTOC.Activo = true; db.Tb_PrecondicionesTOC.Add(tb_PrecondicionesTOC); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception) { return(RedirectToAction("Index")); } }
// GET: PrecondicionesTOC/Edit/5 public ActionResult Edit(int?id) { if (cls_session.checkSession()) { Tb_Usuarios activeuser = Session["activeUser"] as Tb_Usuarios; ViewBag.usuario = activeuser; //NOTIFICATIONS //List<Tb_Alerts> lstAlerts = (from a in db.Tb_Alerts where (a.ID_user == activeuser.ID_User && a.Active == true) select a).OrderByDescending(x => x.Date).Take(4).ToList(); //ViewBag.notifications = lstAlerts; //FILTROS VARIABLES DateTime now = DateTime.Today; DateTime filtrostartdate; DateTime filtroenddate; ////filtros de fecha (MENSUAL) var sunday = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); var saturday = sunday.AddMonths(1).AddDays(-1); if (activeuser.FechaInicioPeriodos == null) { filtrostartdate = sunday; } else { filtrostartdate = Convert.ToDateTime(activeuser.FechaInicioPeriodos); } if (activeuser.FechaFinalPeriodos == null) { filtroenddate = saturday; } else { filtroenddate = Convert.ToDateTime(activeuser.FechaFinalPeriodos); } ViewBag.filtrofechastart = filtrostartdate.ToShortDateString(); ViewBag.filtrofechaend = filtroenddate.ToShortDateString(); Tb_PrecondicionesTOC tb_PrecondicionesTOC = db.Tb_PrecondicionesTOC.Find(id); ViewBag.ID_resultado = new SelectList(db.Tb_Resultados, "ID_resultado", "Codigo", tb_PrecondicionesTOC.ID_resultado); return(View(tb_PrecondicionesTOC)); } else { return(RedirectToAction("Login", "Auth", new { access = false })); } }