Esempio n. 1
0
        public ActionResult Edit(tblAfavorde af)
        {
            ViewBag.Id_Departamento = new SelectList(db.tblDepartamentos, "Id_Departamento", "Departamento");
            ViewBag.Id_Municipio    = new SelectList(db.tblMunicipios, "id_Municipio", "Municipio");

            if (ModelState.IsValid)
            {
                db.Entry(af).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "A favor de";
                notificacion.Message    = string.Format("Edito un A/F");
                notificacion.Date       = DateTime.Now;
                notificacion.Viewed     = false;
                notificacion.Usuario_Id = User.Identity.GetUserId();

                dbs.Notification.Add(notificacion);
                dbs.SaveChanges();
                /*FIN NOTIFICACION*/
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Esempio n. 2
0
        public ActionResult Delete(tblAfavorde af, int id)
        {
            if (ModelState.IsValid)
            {
                var datos = db.tblAfavorde.Find(id);
                db.tblAfavorde.Remove(datos);
                db.SaveChanges();

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "A favor de";
                notificacion.Message    = string.Format("Elimino un A/F");
                notificacion.Date       = DateTime.Now;
                notificacion.Viewed     = false;
                notificacion.Usuario_Id = User.Identity.GetUserId();

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

                return(RedirectToAction("Index"));
            }
            return(View());
        }
Esempio n. 3
0
        public ActionResult Delete(tblAfavorde favorde, int id)
        {
            var datos = db.tblAfavorde.Find(id);

            db.tblAfavorde.Remove(datos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
 public ActionResult Edit(tblAfavorde favorde, int id)
 {
     db.Entry(favorde).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 5
0
 public ActionResult Create(tblAfavorde afavorde)
 {
     db.tblAfavorde.Add(afavorde);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }