Esempio n. 1
0
 public ActionResult Editar_Correspondencia(AddcorrespondenciaViewModel model)
 {
     ViewData["Nombre"]   = AccesoController.nombre;
     ViewData["Apellido"] = AccesoController.apellido;
     try
     {
         if (ModelState.IsValid)
         {
             using (SII_Entities db = new SII_Entities())
             {
                 var obj_Correspondencia = db.Tbl_Correspondencia.Find(model.id_Correspondencia);
                 obj_Correspondencia.id_Correspondencia        = model.id_Correspondencia;
                 obj_Correspondencia.titulo_Correspondencia    = model.titulo_Correspondencia;
                 obj_Correspondencia.subtitulo_Correspondencia = model.subtitulo_Correspondencia;
                 obj_Correspondencia.contenido_Correspondencia = model.contenido_Correspondencia;
                 db.Entry(obj_Correspondencia).State           = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
                 TempData["msg"] = "Modificado";
                 ViewBag.Msg     = TempData["msg"];
             }
             return(Redirect("/ReportPDFCorrespondencia/ShowCorrespondencia"));
         }
         return(View(model));
     }
     catch (Exception)
     {
         return(Redirect("/Error/InaccessiblePage"));
     }
 }
Esempio n. 2
0
        public ActionResult PDFCorrespondencia(AddcorrespondenciaViewModel model)
        {
            ViewData["Nombre"]   = AccesoController.nombre;
            ViewData["Apellido"] = AccesoController.apellido;
            try
            {
                if (ModelState.IsValid)
                {
                    using (SII_Entities db = new SII_Entities())
                    {
                        var obj_Correspondencia = new Tbl_Correspondencia();
                        obj_Correspondencia.titulo_Correspondencia    = model.titulo_Correspondencia;
                        obj_Correspondencia.fecha_Creacion_C          = DateTime.Now;
                        obj_Correspondencia.subtitulo_Correspondencia = model.subtitulo_Correspondencia;
                        obj_Correspondencia.contenido_Correspondencia = model.contenido_Correspondencia;
                        obj_Correspondencia.estado = 1;
                        db.Tbl_Correspondencia.Add(obj_Correspondencia);
                        db.SaveChanges();

                        TempData["msg"] = "Agregado";
                        ViewBag.Msg     = TempData["msg"];
                    }
                    return(Redirect("/ReportPDFCorrespondencia/ShowCorrespondencia"));
                }
                return(View(model));
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
        public ActionResult Editar_Correspondencia(int?IdCorrespondencia)
        {
            try
            {
                ViewData["Nombre"]   = AccesoController.nombre;
                ViewData["Apellido"] = AccesoController.apellido;

                AddcorrespondenciaViewModel model = new AddcorrespondenciaViewModel();
                using (SII_Entities db = new SII_Entities())
                {
                    var obj_Correspondencia = db.Tbl_Correspondencia.Find(IdCorrespondencia);
                    model.id_Correspondencia        = obj_Correspondencia.id_Correspondencia;
                    model.fecha_Creacion_C          = obj_Correspondencia.fecha_Creacion_C;
                    model.titulo_Correspondencia    = obj_Correspondencia.titulo_Correspondencia;
                    model.subtitulo_Correspondencia = obj_Correspondencia.subtitulo_Correspondencia;
                    model.contenido_Correspondencia = obj_Correspondencia.contenido_Correspondencia;
                }
                return(View(model));
            }
            catch (Exception)
            {
                return(Redirect("/Error/InaccessiblePage"));
            }
        }