// GET: Loans/BackBook/id
 public ActionResult BackBook(Loan loan)
 {
     loan.DateFinish      = DateTime.Now;
     loan.StatusId        = 10;
     db.Entry(loan).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public ActionResult Edit([Bind(Include = "IDUSUARIO,IDPRESTAMO,IDROL,IDPERSONA,IDCATEGORIA,IDMATBIBLIO,CONTRASENA,ESTADO")] USUARIO uSUARIO)
        {
            if (ModelState.IsValid)
            {
                db.Entry(uSUARIO).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IDPERSONA = new SelectList(db.PERSONAs, "IDPERSONA", "NOMBRE", uSUARIO.IDPERSONA);
            ViewBag.IDROL     = new SelectList(db.ROLs, "IDROL", "NOMROL", uSUARIO.IDROL);
            return(View(uSUARIO));
        }
示例#3
0
        public IHttpActionResult PutBiblioTB(int id, BiblioTB biblioTB)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != biblioTB.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutComicBiblioteca(long id, ComicBiblioteca comicBiblioteca)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "Id,Nombre,Duracion")] Holograma holograma)
 {
     if (ModelState.IsValid)
     {
         db.Entry(holograma).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(holograma));
 }
示例#6
0
 public ActionResult Edit([Bind(Include = "idLibro,titulo,autor")] libro libro)
 {
     if (ModelState.IsValid)
     {
         db.Entry(libro).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(libro));
 }
示例#7
0
 public ActionResult Edit([Bind(Include = "Id,Nombre")] Grado grado)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grado).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(grado));
 }
 public ActionResult Edit([Bind(Include = "IDDETALLE,LUGARDEESTUDIOS,TRABAJA,ESTUDIA,NOMBREMADRE,NOMBREPADRE")] DETALLEDEPERSONA dETALLEDEPERSONA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dETALLEDEPERSONA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dETALLEDEPERSONA));
 }
示例#9
0
 public ActionResult Edit([Bind(Include = "Id_autor,Nombre,Apellido,Sexo,Pais")] Autor autor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(autor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(autor));
 }
示例#10
0
 public ActionResult Edit([Bind(Include = "idCliente,nombre")] cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cliente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
示例#11
0
 public ActionResult Edit(User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
示例#12
0
 public ActionResult Edit([Bind(Include = "Id_categoria,Categoria1")] Categoria categoria)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categoria).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categoria));
 }
示例#13
0
 public ActionResult Edit([Bind(Include = "ISBN,Autor,Title,NumPages,Edition,Description,Quantity")] Book book)
 {
     if (ModelState.IsValid)
     {
         db.Entry(book).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(book));
 }
示例#14
0
 public ActionResult Edit([Bind(Include = "Id_cliente,Nombre,Apellido,Direccion,Telefono")] Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cliente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
示例#15
0
 public ActionResult Edit([Bind(Include = "Id_editorial,Nombre,Pais,Direccion,Telefono")] Editorial editorial)
 {
     if (ModelState.IsValid)
     {
         db.Entry(editorial).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(editorial));
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "Id_rol,Rol")] Roles roles)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roles).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(roles));
 }
 public ActionResult Edit([Bind(Include = "Id,Nombre,idGrado,Edad,Direccion,Color")] Jedis jedis)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jedis).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idGrado = new SelectList(db.Grado, "Id", "Nombre", jedis.idGrado);
     return(View(jedis));
 }
示例#18
0
        public ActionResult Edit([Bind(Include = "IDPERSONA,IDDETALLE,NOMBRE,APELLIDO,FECHANACIMIENTO,GENERO,DIRECCION,TELEFONO")] PERSONA pERSONA)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pERSONA).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pERSONA));
        }
示例#19
0
 public ActionResult Edit([Bind(Include = "Id_devoluciones,Id_prestamo,FechaDevolucion,Observaciones")] Devoluciones devoluciones)
 {
     if (ModelState.IsValid)
     {
         db.Entry(devoluciones).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id_prestamo = new SelectList(db.Prestamo, "Id_prestamo", "Id_prestamo", devoluciones.Id_prestamo);
     return(View(devoluciones));
 }
示例#20
0
 public ActionResult Edit([Bind(Include = "Id_usuario,Nombre,Apellido,Usuario,Pass,Id_rol")] Usuarios usuarios)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usuarios).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id_rol = new SelectList(db.Roles, "Id_rol", "Rol", usuarios.Id_rol);
     return(View(usuarios));
 }
示例#21
0
 public ActionResult Edit([Bind(Include = "Id_prestamo,Fecha_entrega,Fecha_devolucion,Estado,Id_usuario,Id_cliente")] Prestamo prestamo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(prestamo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id_cliente = new SelectList(db.Cliente, "Id_cliente", "Nombre", prestamo.Id_cliente);
     ViewBag.Id_usuario = new SelectList(db.Usuarios, "Id_usuario", "Nombre", prestamo.Id_usuario);
     return(View(prestamo));
 }
示例#22
0
 public ActionResult Edit([Bind(Include = "Id,idHolograma,idJedi")] HologramaJedi hologramaJedi)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hologramaJedi).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idHolograma = new SelectList(db.Holograma, "Id", "Nombre", hologramaJedi.idHolograma);
     ViewBag.idJedi      = new SelectList(db.Jedis, "Id", "Nombre", hologramaJedi.idJedi);
     return(View(hologramaJedi));
 }
示例#23
0
 public ActionResult Edit([Bind(Include = "idVenta,monto,fecha,fkLibro,fkCliente")] venta venta)
 {
     if (ModelState.IsValid)
     {
         db.Entry(venta).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.fkCliente = new SelectList(db.clientes, "idCliente", "nombre", venta.fkCliente);
     ViewBag.fkLibro   = new SelectList(db.libroes, "idLibro", "titulo", venta.fkLibro);
     return(View(venta));
 }
示例#24
0
 public ActionResult Edit([Bind(Include = "id,idLibro,idPrestamo,cantidad")] detallePrestamo detallePrestamo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(detallePrestamo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idLibro    = new SelectList(db.Libro, "Id_libro", "Titulo", detallePrestamo.idLibro);
     ViewBag.idPrestamo = new SelectList(db.Prestamo, "Id_prestamo", "Estado", detallePrestamo.idPrestamo);
     return(View(detallePrestamo));
 }
示例#25
0
 public ActionResult Edit([Bind(Include = "Id_libro,ISBN,Titulo,Edicion,Fecha_lanzamiento,Descripcion,Idioma,NumeroPaginas,Cantidad,Id_categoria,Id_autor,Id_editorial")] Libro libro)
 {
     if (ModelState.IsValid)
     {
         db.Entry(libro).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id_autor     = new SelectList(db.Autor, "Id_autor", "Nombre", libro.Id_autor);
     ViewBag.Id_categoria = new SelectList(db.Categoria, "Id_categoria", "Categoria1", libro.Id_categoria);
     ViewBag.Id_editorial = new SelectList(db.Editorial, "Id_editorial", "Nombre", libro.Id_editorial);
     return(View(libro));
 }
示例#26
0
        public static void checkDate()
        {
            try
            {
                var loans = db.Loan.Where(d => d.StatusId == 3).ToList().Where(l => l.DateCreate.Value.AddDays(5) >= DateTime.Now);

                foreach (var loan in loans)
                {
                    db.Entry(loan).State = System.Data.Entity.EntityState.Modified;
                }
                db.SaveChanges();

                Console.WriteLine("se actualizaron Loans" + loans.Count());
            }
            catch (Exception ee) {
                Console.WriteLine(ee);
            }
        }
示例#27
0
 public static void Delete(int?id)
 {
     using (BibliotecaEntities db = new BibliotecaEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             try
             {
                 Video Video = db.Video.Find(id);
                 db.Entry(Video).State = System.Data.Entity.EntityState.Deleted;
                 db.SaveChanges();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }
示例#28
0
        public Cliente Salvar(Cliente _Cliente)
        {
            try
            {
                if (_Cliente.Id == 0)
                {
                    bd.Cliente.Add(_Cliente);
                }
                else
                {
                    bd.Entry(_Cliente).State = EntityState.Modified;
                }

                bd.SaveChanges();
                return(_Cliente);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#29
0
        public Livro Salvar(Livro _Livro)
        {
            try
            {
                if (_Livro.Id == 0)
                {
                    bd.Livro.Add(_Livro);
                }
                else
                {
                    bd.Entry(_Livro).State = EntityState.Modified;
                }

                bd.SaveChanges();
                return(_Livro);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#30
0
 public static void Update(Video Video)
 {
     using (BibliotecaEntities db = new BibliotecaEntities())
     {
         using (var transaction = db.Database.BeginTransaction())
         {
             try
             {
                 db.Video.Attach(Video);
                 db.Entry(Video).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }