public IActionResult Update(string id)
        {
            var parm = _context.Parms.Include(e => e.Empresa).FirstOrDefault(e => e.ParmId == id);

            if (parm == null)
            {
                this.ShowSuccess("El parámetro que intenta modificar ya no existe");
                return(this.RedirectAjax(Url.Action("Index")));
            }
            var model = new ParmModificarViewModel()
            {
                ParmId        = parm.ParmId,
                ParmEmpId     = parm.EmpId,
                ParmUniId     = parm.UnId,
                ParmUniNombre = parm.UnId,
                ParmDesc      = parm.ParmDesc,
                ParmValTxt    = _parameters.MustEncript(parm.ParmId) ? _security.DesEncriptar(parm.ParmValTxt) : parm.ParmValTxt,
                ParmValNum    = parm.ParmValNum,
                Tipo          = parm.Tipo,
                ParmBool      = parm.ParmValTxt,
                ParmEmpNombre = (parm.Empresa != null) ? parm.Empresa.EmpRazonSocial : ""
            };

            return(PartialView("_UpdatePartial", model));
        }
Exemplo n.º 2
0
        public IActionResult Update(string id)
        {
            var parm = _context.MasterParms.FirstOrDefault(e => e.MParmId == id);

            if (parm == null)
            {
                this.ShowError("El parámetro que intenta modificar ya no existe");
                return(this.RedirectAjax(Url.Action("Index")));
            }
            var model = new MasterParmModificarViewModel()
            {
                Tipo        = parm.Tipo,
                MParmId     = parm.MParmId,
                MParmDesc   = parm.MParmDesc,
                MParmValTxt = _parameters.MustEncript(parm.MParmId) ? _security.DesEncriptar(parm.MParmValTxt) : parm.MParmValTxt,
                MParmValNum = parm.MParmValNum
            };

            return(PartialView("_UpdatePartial", model));
        }