예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            detallePrestamo detallePrestamo = db.detallePrestamo.Find(id);

            db.detallePrestamo.Remove(detallePrestamo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
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));
 }
예제 #3
0
        // GET: detallePrestamoes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            detallePrestamo detallePrestamo = db.detallePrestamo.Find(id);

            if (detallePrestamo == null)
            {
                return(HttpNotFound());
            }
            return(View(detallePrestamo));
        }
예제 #4
0
        // GET: detallePrestamoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            detallePrestamo detallePrestamo = db.detallePrestamo.Find(id);

            if (detallePrestamo == null)
            {
                return(HttpNotFound());
            }
            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));
        }
예제 #5
0
        public ActionResult DetallesPrestamo(int IdLibro, int cantidad)
        {
            if ((IdLibro > 0 || IdLibro != null) && (cantidad > 0 || cantidad != null))
            {
                detallePrestamo item = new detallePrestamo();

                item.Libro    = db.Libro.Find(IdLibro);
                item.idLibro  = IdLibro;
                item.cantidad = cantidad;

                detalleAux.Add(item);


                return(PartialView(detalleAux));
            }
            else
            {
                return(PartialView(detalleAux));
            }
        }