Exemplo n.º 1
0
        public ActionResult Edit(tblLibros libros, int id)
        {
            db.Entry(libros).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Edit([Bind(Include = "idotorgante,nombres,apellidos,redsocial,telefono,correo,fechanacimiento,lugarnacimiento,Id_Municipio,Id_Departamento")] tblOtorgante tblOtorgante)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblOtorgante).State = EntityState.Modified;
                db.SaveChanges();

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Otorgantes";
                notificacion.Message    = string.Format("Edito 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"));
            }
            ViewBag.Id_Departamento = new SelectList(db.tblDepartamentos, "Id_Departamento", "Departamento");
            ViewBag.Id_Municipio    = new SelectList(db.tblMunicipios, "id_Municipio", "Municipio");
            return(View(tblOtorgante));
        }
Exemplo n.º 3
0
        public IHttpActionResult PutinfoMaster(int id, infoMaster infoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != infoMaster.Id)
            {
                return(BadRequest());
            }

            db.Entry(infoMaster).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!infoMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 4
0
        public IHttpActionResult PutLoginDetail(int id, LoginDetail loginDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != loginDetail.loginid)
            {
                return(BadRequest());
            }

            db.Entry(loginDetail).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LoginDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 5
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());
        }
Exemplo n.º 6
0
        public ActionResult Edit([Bind(Include = "Id_Personal,Nombres,Apellidos,redsocial,Telefono,Correo,Direccion,Fecha_Nacimiento,id_CategoriaPersonal,Id_EstadoRegistro,Fecha_Agregado")] tblPersonal tblPersonal)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblPersonal).State = EntityState.Modified;
                db.SaveChanges();


                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Personal";
                notificacion.Message    = string.Format("Edito informacion de personal");
                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_CategoriaPersonal = new SelectList(db.tblCategoriaPersonal, "id_CategoriaPersonal", "CategoriaPersonal", tblPersonal.id_CategoriaPersonal);
            ViewBag.Id_EstadoRegistro    = new SelectList(db.tblEstadosRegistros, "Id_EstadoRegistro", "Estado", tblPersonal.Id_EstadoRegistro);
            return(View(tblPersonal));
        }
Exemplo n.º 7
0
        public IHttpActionResult PutUsuario(int id, Usuario usuario)
        {
            if (id != usuario.Id)
            {
                return(BadRequest());
            }

            db.Entry(usuario).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UsuarioExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 8
0
        public ActionResult Edit([Bind(Include = "Id_Caso,Id_Cliente,Id_Categoria,Id_EstadoCaso,Id_Departamento,Id_Municipio,Id_Juzgado,Titulo,Numero_Caso,Fecha_Inicio,Fecha_Audiencia,Fecha_Agregado")] tblCasos tblCasos)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblCasos).State = EntityState.Modified;
                db.SaveChanges();
                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Casos";
                notificacion.Message    = string.Format("Edito un caso");
                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_Categoria    = new SelectList(db.tblCategorias, "Id_Categoria", "Nombre_Categoria", tblCasos.Id_Categoria);
            ViewBag.Id_Cliente      = new SelectList(db.tblClientes, "Id_Cliente", "NombreCompleto", tblCasos.Id_Cliente);
            ViewBag.Id_Departamento = new SelectList(db.tblDepartamentos, "Id_Departamento", "Departamento", tblCasos.Id_Departamento);
            ViewBag.Id_EstadoCaso   = new SelectList(db.tblEstadosCasos, "Id_EstadoCaso", "Nombre_Estado", tblCasos.Id_EstadoCaso);
            ViewBag.Id_Juzgado      = new SelectList(db.tblJuzgados, "Id_Juzgado", "Juzgado", tblCasos.Id_Juzgado);
            ViewBag.Id_Municipio    = new SelectList(db.tblMunicipios, "id_Municipio", "Municipio", tblCasos.Id_Municipio);
            return(View(tblCasos));
        }
Exemplo n.º 9
0
        public IHttpActionResult PutEmpolyee(int id, Empolyee empolyee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != empolyee.EmployeeId)
            {
                return(BadRequest());
            }

            db.Entry(empolyee).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmpolyeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 10
0
        public IHttpActionResult PutDESIGNATION(int id, DESIGNATION dESIGNATION)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            if (id != dESIGNATION.DG_ID)
            {
                return(BadRequest());
            }

            db.Entry(dESIGNATION).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DESIGNATIONExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "Id_Departamento,Departamento")] tblDepartamentos tblDepartamentos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblDepartamentos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblDepartamentos));
 }
Exemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "Id_EstadoCaso,Nombre_Estado")] tblEstadosCasos tblEstadosCasos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblEstadosCasos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblEstadosCasos));
 }
Exemplo n.º 13
0
 public ActionResult Edit([Bind(Include = "Id_Categoria,Nombre_Categoria")] tblCategorias tblCategorias)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblCategorias).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblCategorias));
 }
Exemplo n.º 14
0
 public ActionResult Edit([Bind(Include = "id_Municipio,Municipio,Id_Departamento")] tblMunicipios tblMunicipios)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblMunicipios).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id_Departamento = new SelectList(db.tblDepartamentos, "Id_Departamento", "Departamento", tblMunicipios.Id_Departamento);
     return(View(tblMunicipios));
 }
Exemplo n.º 15
0
 /// <summary>
 /// Adds <paramref name="Donor"/> to the db.
 /// </summary>
 /// <param name="Donor">The donate.</param>
 /// <returns>Id of added donor</returns>
 public string CreateDonor(Donor Donor)
 {
     if (!context.Donors.Any(x => x.PESEL == Donor.PESEL))
     {
         context.Entry(Donor).State = EntityState.Added;
         context.SaveChanges();
         return(Donor.PESEL);
     }
     else
     {
         return("");
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Adds or edits the <paramref name="Acceptor"/> to the db.
        /// </summary>
        /// <param name="Acceptor">The donate.</param>
        /// <returns>ID of added of edited acceptor.</returns>
        public int CreateAcceptor(Acceptor Acceptor)
        {
            if ((Acceptor.User.Id == 0) &&
                (context.Users.FirstOrDefault(x => x.Login == Acceptor.User.Login) != default(User)))
            {
                return(0);
            }

            context.Entry(Acceptor).State = Acceptor.Id == 0 ?
                                            EntityState.Added :
                                            EntityState.Modified;
            context.SaveChanges();
            return(Acceptor.Id);
        }
Exemplo n.º 17
0
        public ActionResult Edit([Bind(Include = "idEditable,fecha,entidad,instrumento,documento,tipo_documento,img,descripcion")] tblEditables tblEditables)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0)
                {
                    HttpPostedFileBase file = Request.Files[0];
                    if (file.ContentLength > 0)
                    {
                        var img = (file.FileName).ToLower();
                        tblEditables.img = "/Content/Editables/" + img;
                        file.SaveAs(Server.MapPath("~/Content/Editables/") + img);
                    }
                    var queryarchivo = (from x in db.tblEditables
                                        where x.idEditable == tblEditables.idEditable
                                        select x.img).First();

                    if (file.ContentLength == 0)
                    {
                        //var query = (from x in db.tblLibros
                        //             where x.idlibros == tblLibros.idlibros
                        //             select x.word).First();
                        //tblLibros.img = query.img;
                        tblEditables.img = queryarchivo;
                    }
                }
                db.Entry(tblEditables).State = EntityState.Modified;
                db.SaveChanges();

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Editables";
                notificacion.Message    = string.Format("Edito un archivo editable");
                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(tblEditables));
        }
Exemplo n.º 18
0
        public ActionResult Edit([Bind(Include = "Id_Historial,Id_Caso,Fecha_Inicio,Fecha_Final,Descripcion,Archivo,Fecha_Agregado")] tblHistorial tblHistorial)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0)
                {
                    HttpPostedFileBase file = Request.Files[0];
                    if (file.ContentLength > 0)
                    {
                        var img = (file.FileName).ToLower();
                        tblHistorial.Archivo = "/Content/Historial/" + img;
                        file.SaveAs(Server.MapPath("~/Content/Historial/") + img);
                    }
                    var queryarchivo = (from x in db.tblHistorial
                                        where x.Id_Historial == tblHistorial.Id_Historial
                                        select x.Archivo).First();

                    if (file.ContentLength == 0)
                    {
                        //var query = (from x in db.tblLibros
                        //             where x.idlibros == tblLibros.idlibros
                        //             select x.word).First();
                        //tblLibros.img = query.img;
                        tblHistorial.Archivo = queryarchivo;
                    }
                }
                db.Entry(tblHistorial).State = EntityState.Modified;
                db.SaveChanges();

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Historial";
                notificacion.Message    = string.Format("Edito un historial");
                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_Caso = new SelectList(db.tblCasos, "Id_Caso", "Numero_Caso", tblHistorial.Id_Caso);
            return(View(tblHistorial));
        }
Exemplo n.º 19
0
        public ActionResult Edit(int id, Table_1 table_1)
        {
            try
            {
                using (dbModel Dbmodel = new dbModel())
                {
                    Dbmodel.Entry(table_1).State = EntityState.Modified;
                    Dbmodel.SaveChanges();
                }
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// Adds <paramref name="Donate"/> th the db and makes changes to the statistics.
        /// </summary>
        /// <param name="Donate">The donate.</param>
        /// <returns>Id of added donate</returns>
        public int CreateDonate(Donate Donate)
        {
            context.Donates.Add(Donate);
            BloodTypeMarker BloodTypeMarker;

            switch (Donate.Donor.Blood_Type)
            {
            case BloodType.O:
                BloodTypeMarker = BloodTypeMarker.O;
                break;

            case BloodType.A:
                BloodTypeMarker = BloodTypeMarker.A;
                break;

            case BloodType.B:
                BloodTypeMarker = BloodTypeMarker.B;
                break;

            default:
                BloodTypeMarker = BloodTypeMarker.AB;
                break;
            }

            if (Donate.Donor.Blood_RhMarker)
            {
                BloodTypeMarker += 1;
            }

            var stat = context.Statistics.Find(BloodTypeMarker);

            stat.TotalAmount         += Donate.Amount;
            context.Entry(stat).State = EntityState.Modified;

            context.SaveChanges();
            return(Donate.Id);
        }
        public ActionResult Edit([Bind(Include = "Id_EstadoRegistro,Estado")] tblEstadosRegistros tblEstadosRegistros)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblEstadosRegistros).State = EntityState.Modified;
                db.SaveChanges();

                /*Notificacion*/
                ApplicationDbContext bd           = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Estado de registro Cliente/Personal";
                notificacion.Message    = string.Format("Edito un estado Cliente/Personal");
                notificacion.Date       = DateTime.Now;
                notificacion.Viewed     = false;
                notificacion.Usuario_Id = User.Identity.GetUserId();

                bd.Notification.Add(notificacion);
                bd.SaveChanges();
                /*Fin Notificacion*/

                return(RedirectToAction("Index"));
            }
            return(View(tblEstadosRegistros));
        }
        public ActionResult Edit([Bind(Include = "id_CategoriaPersonal,CategoriaPersonal")] tblCategoriaPersonal tblCategoriaPersonal)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblCategoriaPersonal).State = EntityState.Modified;
                db.SaveChanges();

                /*Notificacion*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Categoria personal";
                notificacion.Message    = string.Format("Edito 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"));
            }
            return(View(tblCategoriaPersonal));
        }
Exemplo n.º 23
0
        public ActionResult Indexx(int txtID, string btnAgregar, string btnEditar, string btnEliminar, string txtFechaInicio, string txtFechaFin, string txtTitulo, string txtHora, string txtDescripcion, string txtColor, tblEventCalendar ev)
        {
            if (Request.HttpMethod == "POST")
            {
                if (btnAgregar == "agregar")
                {
                    var datosevento = new tblEventCalendar
                    {
                        id_Event    = txtID,
                        title       = txtTitulo,
                        descripcion = txtDescripcion,
                        color       = txtColor,
                        textColor   = "#FFFFFF",
                        start       = Convert.ToDateTime(txtFechaInicio + " " + txtHora),
                        end         = Convert.ToDateTime(txtFechaFin + " " + txtHora)
                    };
                    db.tblEventCalendar.Add(datosevento);
                    db.SaveChanges();

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

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

                    return(RedirectToAction("Index", "Home"));
                }
                else if (btnEditar == "editar")
                {
                    var datosevento = new tblEventCalendar
                    {
                        id_Event    = txtID,
                        title       = txtTitulo,
                        descripcion = txtDescripcion,
                        color       = txtColor,
                        textColor   = "#FFFFFF",
                        start       = Convert.ToDateTime(txtFechaInicio),
                        end         = Convert.ToDateTime(txtFechaFin)
                    };
                    db.tblEventCalendar.Attach(datosevento);
                    db.Entry(datosevento).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

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

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

                    return(RedirectToAction("Index", "Home"));
                }
                else if (btnEliminar == "eliminar")
                {
                    var datosevento = new tblEventCalendar
                    {
                        id_Event    = txtID,
                        title       = txtTitulo,
                        descripcion = txtDescripcion,
                        color       = txtColor,
                        textColor   = "#FFFFFF",
                        start       = Convert.ToDateTime(txtFechaInicio),
                        end         = Convert.ToDateTime(txtFechaFin)
                    };
                    db.tblEventCalendar.Attach(datosevento);
                    db.tblEventCalendar.Remove(datosevento);
                    db.SaveChanges();

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

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

                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 24
0
 /// <summary>
 /// Changes Send value of the Order to true.
 /// </summary>
 /// <param name="Order">The order.</param>
 public void MarkAsSend(Order Order)
 {
     Order.Send = true;
     context.Entry(Order).State = EntityState.Modified;
     context.SaveChanges();
 }
Exemplo n.º 25
0
        public ActionResult Edit([Bind(Include = "idlibros,fecha,correlativo,instrumento,folios,libro,img,word,idotorgante,idfavorde,id_Personal")] tblLibros tblLibros)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0)
                {
                    HttpPostedFileBase file  = Request.Files[0];
                    HttpPostedFileBase file2 = Request.Files[1];

                    if (file.ContentLength > 0)
                    {
                        var img = (file.FileName).ToLower();
                        tblLibros.img = "/Content/Libros/" + img;
                        file.SaveAs(Server.MapPath("~/Content/Libros/") + img);
                    }
                    if (file2.ContentLength > 0)
                    {
                        var doc = (file2.FileName).ToLower();
                        tblLibros.word = "/Content/Libros/" + doc;
                        file2.SaveAs(Server.MapPath("~/Content/Libros/") + doc);
                    }

                    var querypdf = (from x in db.tblLibros
                                    where x.idlibros == tblLibros.idlibros
                                    select x.img).First();

                    var queryword = (from x in db.tblLibros
                                     where x.idlibros == tblLibros.idlibros
                                     select x.word).First();

                    if (file.ContentLength == 0)
                    {
                        tblLibros.img = querypdf;
                        //tblLibros.word = query.word;
                    }
                    if (file2.ContentLength == 0)
                    {
                        //var query = (from x in db.tblLibros
                        //             where x.idlibros == tblLibros.idlibros
                        //             select x.word).First();
                        //tblLibros.img = query.img;
                        tblLibros.word = queryword;
                    }

                    db.Entry(tblLibros).State = EntityState.Modified;
                    db.SaveChanges();
                }

                /*NOTIFICACION*/
                ApplicationDbContext dbs          = new ApplicationDbContext();
                Notifications        notificacion = new Notifications();
                notificacion.Module     = "Libros";
                notificacion.Message    = string.Format("Edito un libro");
                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.idfavorde   = new SelectList(db.tblAfavorde, "idfavorde", "nombres", tblLibros.idfavorde);
            ViewBag.idotorgante = new SelectList(db.tblOtorgante, "idotorgante", "nombres", tblLibros.idotorgante);
            ViewBag.id_Personal = new SelectList(db.tblPersonal, "Id_Personal", "Nombres", tblLibros.id_Personal);
            return(View(tblLibros));
        }
Exemplo n.º 26
0
 public ActionResult Edit(tblAfavorde favorde, int id)
 {
     db.Entry(favorde).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }