示例#1
0
        public ActionResult QuitarLibro(int id, Libro libro)
        {
            try
            {
                SessionInitialize();

                AlbumCAD    cad2   = new AlbumCAD(session);
                AlbumCEN    cen2   = new AlbumCEN(cad2);
                LibroCAD    cad    = new LibroCAD(session);
                LibroCEN    cen    = new LibroCEN(cad);
                LibroEN     en     = cen.ReadOID(libro.id);
                IList <int> libros = null;
                libros.Add(en.Id);
                cen2.QuitarLibroAlbum(id, libros);



                SessionClose();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Create(Album model)
        {
            try
            {
                SessionInitialize();
                AlbumCAD cad = new AlbumCAD(session);
                AlbumCEN cen = new AlbumCEN(cad);

                cen.New_(model.titulo, model.descripcion, model.cantidad, model.usuario.Id);

                SessionClose();



                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }


            // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario
            return(View(model));
        }
示例#3
0
        // GET: Album/Details/5

        public ActionResult Details(int id)
        {
            Album usu = null;

            SessionInitialize();
            AlbumEN artEN = new AlbumCAD(session).ReadOIDDefault(id);

            usu = new AlbumAssembler().ConvertENToModelUI(artEN);
            SessionClose();
            return(View(usu));
        }
示例#4
0
        //
        // GET: /Album/Delete/5

        public ActionResult Delete(int id)
        {
            SessionInitialize();
            AlbumCAD usuCAD = new AlbumCAD(session);
            AlbumCEN cen    = new AlbumCEN(usuCAD);
            AlbumEN  usuEN  = cen.ReadOID(id);
            Album    usu    = new AlbumAssembler().ConvertENToModelUI(usuEN);

            SessionClose();

            return(View(usu));
        }
示例#5
0
        public ActionResult leerNombre(string nombre)
        {
            SessionInitialize(); //hace falta crear el CEN con el CAD?
            AlbumCAD cadArt = new AlbumCAD(session);
            AlbumCEN cen    = new AlbumCEN(cadArt);

            IList <AlbumEN> listArtEn = cen.LeerNombre(nombre);
            IList <Album>   listArt   = new AlbumAssembler().ConvertListENToModel(listArtEn).ToList();


            SessionClose();
            return(View(listArt));
        }
示例#6
0
        public ActionResult Edit(Album publi)
        {
            try
            {
                SessionInitialize();
                AlbumCAD cad = new AlbumCAD(session);
                AlbumCEN cen = new AlbumCEN(cad);

                cen.Modify(publi.id, publi.titulo, publi.descripcion, publi.cantidad);
                SessionClose();
                return(RedirectToAction("Details", new { id = publi.id }));
            }
            catch
            {
                return(View());
            }
        }
示例#7
0
        public ActionResult Delete(Album usu)
        {
            try
            {
                SessionInitialize();
                AlbumCAD usuCAD = new AlbumCAD(session);
                AlbumCEN cen    = new AlbumCEN(usuCAD);
                cen.Destroy(usu.id);

                SessionClose();

                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(View());
            }
        }