public ActionResult Buscar(EquipoTransporteDTO _model) { if (Session["StringToken"] == null) { return(View(AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } return(RedirectToAction("Index", new { placa = _model.PlacasBusq, vehiculo = _model.AliasUnidadBusq })); }
// GET: EquipoTransporte public ActionResult Index(int?id, string placa = null, string vehiculo = null, string msj = null) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home")); } _tkn = Session["StringToken"].ToString(); if (!string.IsNullOrEmpty(msj)) { ViewBag.Msj = msj; } ViewBag.EsAdmin = TokenServicio.ObtenerEsAdministracionCentral(_tkn); ViewBag.IdEmpresa = TokenServicio.ObtenerIdEmpresa(_tkn); ViewBag.Vehiculos = CatalogoServicio.Obtener(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn); ViewBag.TipoCombustible = CatalogoServicio.ListaCombustibleIdEmp(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn); ViewBag.TipoUnidad = CatalogoServicio.ListaUnidadIdEmp(TokenServicio.ObtenerIdEmpresa(_tkn), _tkn); ViewBag.TipoMedidor = CatalogoServicio.ListaMedidores(_tkn); EquipoTransporteDTO model = new EquipoTransporteDTO(); if (id != 0 && id != null) { model = CatalogoServicio.Obtener(id.Value, _tkn); ViewBag.EsEdicion = true; } if ((placa != "" && placa != null) || (vehiculo != "" && vehiculo != null)) { model.AliasUnidadBusq = vehiculo; model.PlacasBusq = placa; ViewBag.Vehiculos = CatalogoServicio.Obtener(TokenServicio.ObtenerIdEmpresa(_tkn), placa, vehiculo, _tkn); } if (TempData["RespuestaDTO"] != null) { if (!((RespuestaDTO)TempData["RespuestaDTO"]).Exito) { ViewBag.MensajeError = Validar((RespuestaDTO)TempData["RespuestaDTO"]); } else { ViewBag.Tipo = "alert-success"; ViewBag.Msj = msj; } } return(View(model)); }
public ActionResult GuardarEditar(EquipoTransporteDTO model) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tkn = Session["StringToken"].ToString(); var respuesta = CatalogoServicio.Modificar(model, _tkn); TempData["RespuestaDTO"] = respuesta; if (respuesta.Exito) { return(RedirectToAction("Index", new { msj = respuesta.Mensaje })); } else { return(RedirectToAction("Index")); } }
public ActionResult Alta(EquipoTransporteDTO _model) { if (Session["StringToken"] == null) { return(RedirectToAction("Index", "Home", AutenticacionServicio.InitIndex(new Models.Seguridad.LoginModel()))); } string _tkn = Session["StringToken"].ToString(); _model.IdEmpresa = TokenServicio.ObtenerIdEmpresa(_tkn); var respuesta = CatalogoServicio.Crear(_model, _tkn); TempData["RespuestaDTO"] = respuesta; if (respuesta.Exito) { return(RedirectToAction("Index", new { msj = respuesta.Mensaje })); } else { return(RedirectToAction("Index")); } }