public ActionResult Create([Bind(Include = "id_CategoriaPersonal,CategoriaPersonal")] tblCategoriaPersonal tblCategoriaPersonal) { if (ModelState.IsValid) { db.tblCategoriaPersonal.Add(tblCategoriaPersonal); db.SaveChanges(); /*Notificacion*/ ApplicationDbContext dbs = new ApplicationDbContext(); Notifications notificacion = new Notifications(); notificacion.Module = "Categoria personal"; notificacion.Message = string.Format("Registro una nueva categoria"); 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(tblCategoriaPersonal)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblCategoriaPersonal tblCategoriaPersonal = db.tblCategoriaPersonal.Find(id); if (tblCategoriaPersonal == null) { return(HttpNotFound()); } return(View(tblCategoriaPersonal)); }
public ActionResult DeleteConfirmed(int id) { tblCategoriaPersonal tblCategoriaPersonal = db.tblCategoriaPersonal.Find(id); db.tblCategoriaPersonal.Remove(tblCategoriaPersonal); db.SaveChanges(); /*Notificacion*/ ApplicationDbContext dbs = new ApplicationDbContext(); Notifications notificacion = new Notifications(); notificacion.Module = "Categoria personal"; notificacion.Message = string.Format("Elimino una categoria registrada"); notificacion.Date = DateTime.Now; notificacion.Viewed = false; notificacion.Usuario_Id = User.Identity.GetUserId(); dbs.Notification.Add(notificacion); dbs.SaveChanges(); /*Fin Notificacion*/ return(RedirectToAction("Index")); }