コード例 #1
0
        public ActionResult Create(tblOtorgante otorgantes)
        {
            db.tblOtorgante.Add(otorgantes);
            db.SaveChanges();

            return(RedirectToAction("index"));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "idotorgante,nombres,apellidos,redsocial,telefono,correo,fechanacimiento,lugarnacimiento,Id_Municipio,Id_Departamento")] tblOtorgante tblOtorgante)
        {
            if (ModelState.IsValid)
            {
                db.tblOtorgante.Add(tblOtorgante);
                db.SaveChanges();

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Otorgantes";
                notificacion.Message    = string.Format("Registro un nuevo Otorgante");
                notificacion.Date       = DateTime.Now;
                notificacion.Viewed     = false;
                notificacion.Usuario_Id = User.Identity.GetUserId();

                dbs.Notification.Add(notificacion);
                dbs.SaveChanges();
                /*FIN NOTIFICACION*/

                return(RedirectToAction("Index"));
            }
            ViewBag.Id_Departamento = new SelectList(db.tblDepartamentos, "Id_Departamento", "Departamento");
            ViewBag.Id_Municipio    = new SelectList(db.tblMunicipios, "id_Municipio", "Municipio");
            return(View(tblOtorgante));
        }
コード例 #3
0
        public ActionResult Delete(tblOtorgante otorgante, int id)
        {
            var datos = db.tblOtorgante.Find(id);

            db.tblOtorgante.Remove(datos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblOtorgante tblOtorgante = db.tblOtorgante.Find(id);

            if (tblOtorgante == null)
            {
                return(HttpNotFound());
            }
            return(View(tblOtorgante));
        }
コード例 #5
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblOtorgante tblOtorgante = db.tblOtorgante.Find(id);

            if (tblOtorgante == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id_Departamento = new SelectList(db.tblDepartamentos, "Id_Departamento", "Departamento");
            ViewBag.Id_Municipio    = new SelectList(db.tblMunicipios, "id_Municipio", "Municipio");
            return(View(tblOtorgante));
        }
コード例 #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblOtorgante tblOtorgante = db.tblOtorgante.Find(id);

            db.tblOtorgante.Remove(tblOtorgante);
            db.SaveChanges();

            /*NOTIFICACION*/
            ApplicationDbContext dbs          = new ApplicationDbContext();
            Notifications        notificacion = new Notifications();

            notificacion.Module     = "Otorgantes";
            notificacion.Message    = string.Format("Elimino un Otorgante");
            notificacion.Date       = DateTime.Now;
            notificacion.Viewed     = false;
            notificacion.Usuario_Id = User.Identity.GetUserId();

            dbs.Notification.Add(notificacion);
            dbs.SaveChanges();
            /*FIN NOTIFICACION*/

            return(RedirectToAction("Index"));
        }
コード例 #7
0
 public ActionResult Edit(tblOtorgante otorgantes, int id)
 {
     db.Entry(otorgantes).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }