public ActionResult Edit(int id, Serie collection) { try { // TODO: Add update logic here SerieCEN cen = new SerieCEN(); SerieEN en = cen.get_ISerieCAD().ReadOIDDefault(id); string img = collection.Imagen; if (collection.Imagen == null) { img = en.Imagen; } cen.Modify(id, (SMPGenNHibernate.Enumerated.SMP.ValoracionEnum)collection.Valoracion, collection.Nombre, img, en.Descriplarga, en.Descripcion, en.Genero, en.Anyo, en.Imagran, en.Anyofin, en.Finalizada); //cen.New_(collection.Nombre, collection.Precio, collection.Descripcion, collection.Imagen, collection.Valor, collection.Stock, collection.Talla); string action = System.Web.HttpContext.Current.Session["action"] as String; string controller = System.Web.HttpContext.Current.Session["controller"] as String; Object arg = System.Web.HttpContext.Current.Session["arg"]; return(RedirectToAction(action, controller, arg)); } catch { return(View()); } }
// GET: Articulo/Delete/5 public ActionResult Delete(int id) { SerieCEN cen = new SerieCEN(); SerieEN en = new SerieEN(); en = cen.ReadOID(id); AssemblerSerie ass = new AssemblerSerie(); Serie sol = ass.ConvertENToModelUI(en); return(View(sol)); }
// GET: Articulo/Edit/5 public ActionResult Edit(int id) { SerieCEN cen = new SerieCEN(); SerieEN en = new SerieEN(); en = cen.ReadOID(id); // SessionInitializeTransaction(); //IProducto productoCAD = new productoCAD(session); // ProductoEN en = new Pro; AssemblerSerie ass = new AssemblerSerie(); Serie sol = ass.ConvertENToModelUI(en); return(View(sol)); }
// GET: Articulo/mostrar_temp/5 public ActionResult mostrar_temp(int id) { //lazy-fetching = false; SessionInitialize(); SerieCAD cad = new SerieCAD(session); SerieCEN cen = new SerieCEN(cad); SerieEN en = cen.ReadOID(id); IList <TemporadaEN> ten = en.Temporada; AssemblerTemporada ass = new AssemblerTemporada(); IList <Temporada> sol = ass.ConvertListENToModel(ten); SessionClose(); System.Web.HttpContext.Current.Session["idserie"] = new { id = id }; return(View(sol)); }
public ActionResult Filtrar(FiltroSerie collection) { try { SerieCEN cen = new SerieCEN(); IList <SerieEN> res = null, aux = null; // TODO: Add delete logic here res = cen.ReadAll(0, int.MaxValue); if (!(collection.anyobol == false || collection.anyomin <= 0 || collection.anyomax <= 0 || collection.anyomax <= collection.anyomin)) { aux = cen.Filtroanyo(collection.anyomin, collection.anyomax); res = res.Intersect(aux).ToList(); } if (collection.Nombrebol == true && collection.Nombre != null) { aux = cen.Filtronombre(collection.Nombre); res = res.Intersect(aux).ToList(); } if (collection.generobol == true && collection.genero != null) { aux = cen.Filtrogenero(collection.genero); res = res.Intersect(aux).ToList(); } if (collection.Valoracionbol == true && collection.Valoracion > 0 && collection.Valoracion < 6) { aux = cen.Filtrovalor((SMPGenNHibernate.Enumerated.SMP.ValoracionEnum)collection.Valoracion); res = res.Intersect(aux).ToList(); } AssemblerSerie ass = new AssemblerSerie(); IList <Serie> listart = ass.ConvertListENToModel(res); return(View("Resultadobusqueda", listart)); } catch { return(View()); } }
public ActionResult Create(Serie collection) { try { // TODO: Add insert logic here SerieCEN cen = new SerieCEN(); cen.New_((SMPGenNHibernate.Enumerated.SMP.ValoracionEnum)collection.Valoracion, collection.Nombre, collection.imagran, collection.desclar, collection.descripcion, collection.genero, collection.fecha, collection.imagran, collection.fechafin, collection.finalizada); string action = System.Web.HttpContext.Current.Session["action"] as String; string controller = System.Web.HttpContext.Current.Session["controller"] as String; Object arg = System.Web.HttpContext.Current.Session["arg"]; return(RedirectToAction(action, controller, arg)); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here SerieCEN cen = new SerieCEN(); cen.Destroy(id); string action = System.Web.HttpContext.Current.Session["action"] as String; string controller = System.Web.HttpContext.Current.Session["controller"] as String; Object arg = System.Web.HttpContext.Current.Session["arg"]; return(RedirectToAction(action, controller, arg)); } catch { return(View()); } }
public ActionResult Index_Usu() { SerieCEN cen = new SerieCEN(); IList <SerieEN> enlinst = cen.ReadAll(0, int.MaxValue); AssemblerSerie ass = new AssemblerSerie(); IList <Serie> listart = ass.ConvertListENToModel(enlinst); int max = listart.Count; Random aleatorio = new Random(); int uno = aleatorio.Next(1, max); int dos = aleatorio.Next(1, max); while (dos == uno) { dos = aleatorio.Next(1, max); } int tres = aleatorio.Next(1, max); while (dos == tres || uno == tres) { tres = aleatorio.Next(1, max); } IList <Serie> resu = new List <Serie>(); resu.Add(listart.ElementAt(uno)); resu.Add(listart.ElementAt(dos)); resu.Add(listart.ElementAt(tres)); ViewBag.serie = resu; System.Web.HttpContext.Current.Session["controller"] = "Serie"; System.Web.HttpContext.Current.Session["action"] = "Index_Usu"; System.Web.HttpContext.Current.Session["arg"] = null; return(View(listart)); }
public void Anyadirtemporada(int p_oid, string p_nombre) { /*PROTECTED REGION ID(SMPGenNHibernate.CP.SMP_Serie_anyadirtemporada) ENABLED START*/ ISerieCAD serieCAD = null; SerieCEN serieCEN = null; try { SessionInitializeTransaction(); serieCAD = new SerieCAD(session); serieCEN = new SerieCEN(serieCAD); // Write here your custom transaction ... throw new NotImplementedException("Method Anyadirtemporada() not yet implemented."); SessionCommit(); } catch (Exception ex) { SessionRollBack(); throw ex; } finally { SessionClose(); } /*PROTECTED REGION END*/ }
// GET: Articulo/Details/5 public ActionResult Details(int id) { SessionInitialize(); SerieCAD cad = new SerieCAD(session); SerieCEN cen = new SerieCEN(cad); SerieEN en = cen.ReadOID(id); AssemblerSerie ass = new AssemblerSerie(); Serie sol = ass.ConvertENToModelUI(en); IList <TemporadaEN> ten = en.Temporada; AssemblerTemporada assc = new AssemblerTemporada(); IList <Temporada> solc = assc.ConvertListENToModel(ten); SessionClose(); System.Web.HttpContext.Current.Session["id_serie"] = id; ViewBag.temp = solc; return(View(sol)); }
public ActionResult Create(int id, Comentario collection) { try { PeliculaCEN cenp = new PeliculaCEN(); PeliculaEN enp = cenp.ReadOID(id); SerieCEN cens = new SerieCEN(); SerieEN ens = cens.ReadOID(id); ProductoCEN cena = new ProductoCEN(); ProductoEN ena = cena.ReadOID(id); string tipo; if (enp != null) { tipo = "Pelicula"; } else if (ens != null) { tipo = "Serie"; } else if (ena != null) { tipo = "Producto"; } else { tipo = "Evento"; } // TODO: Add insert logic here ComentarioCEN cen = new ComentarioCEN(); DateTime fecha = DateTime.Today; int e = cen.New_(collection.comentario, System.Web.HttpContext.Current.Session["nombre"] as string, new DateTime(fecha.Year, fecha.Month, fecha.Day)); List <int> es = new List <int>(); es.Add(e); if (tipo == "Capitulo") { CapituloCEN ccen = new CapituloCEN(); ccen.Addcomentario(id, es); cen.Addcap(e, id); } else if (tipo == "Pelicula") { PeliculaCEN ccen = new PeliculaCEN(); ccen.Addcomentario(id, es); cen.Addpel(e, id); } else if (tipo == "Producto" || tipo == "Evento") { ArticuloCEN ccen = new ArticuloCEN(); ccen.Addcomentario(id, es); cen.Addart(e, id); } return(RedirectToAction("Details", tipo, new { id = id })); } catch { return(View()); } }
public ActionResult Index() { // if (System.Web.HttpContext.Current.Session["log"] != null && (bool)System.Web.HttpContext.Current.Session["log"]) { // IList<Pelicula> resu = new List<Pelicula>(); // ViewBag.peli = resu; // IList<Serie> resus = new List<Serie>(); // ViewBag.serie = resus; //} // else { PeliculaCEN cen = new PeliculaCEN(); IList <PeliculaEN> enlinst = cen.ReadAll(0, int.MaxValue); AssemblerPelicula ass = new AssemblerPelicula(); IList <Pelicula> listart = ass.ConvertListENToModel(enlinst); int max = listart.Count; Random aleatorio = new Random(); int uno = aleatorio.Next(1, max); int dos = aleatorio.Next(1, max); while (dos == uno) { dos = aleatorio.Next(1, max); } int tres = aleatorio.Next(1, max); while (dos == tres || uno == tres) { tres = aleatorio.Next(1, max); } int cuatro = aleatorio.Next(1, max); while (dos == cuatro || uno == cuatro || tres == cuatro) { cuatro = aleatorio.Next(1, max); } IList <Pelicula> resu = new List <Pelicula>(); resu.Add(listart.ElementAt(uno)); resu.Add(listart.ElementAt(dos)); resu.Add(listart.ElementAt(tres)); resu.Add(listart.ElementAt(cuatro)); ViewBag.peli = resu; SerieCEN cens = new SerieCEN(); IList <SerieEN> enlinsts = cens.ReadAll(0, int.MaxValue); AssemblerSerie asss = new AssemblerSerie(); IList <Serie> listarts = asss.ConvertListENToModel(enlinsts); int maxs = listarts.Count; Random aleatorios = new Random(); int unos = aleatorios.Next(1, maxs); int doss = aleatorios.Next(1, maxs); while (doss == unos) { doss = aleatorios.Next(1, maxs); } int tress = aleatorios.Next(1, maxs); while (doss == tress || unos == tress) { tress = aleatorios.Next(1, maxs); } int cuatross = aleatorios.Next(1, maxs); while (doss == cuatross || unos == cuatross || tress == cuatross) { cuatross = aleatorios.Next(1, maxs); } IList <Serie> resus = new List <Serie>(); resus.Add(listarts.ElementAt(unos)); resus.Add(listarts.ElementAt(doss)); resus.Add(listarts.ElementAt(tress)); resus.Add(listarts.ElementAt(cuatross)); ViewBag.serie = resus; // } return(View()); }
public ActionResult addlist(string idus, int idpro, string lista) { if (idus == null) { return(RedirectToAction("log", "Usuario", null)); } SessionInitialize(); UsuarioCAD cad = new UsuarioCAD(session); UsuarioCEN cen = new UsuarioCEN(cad); UsuarioEN en = cen.ReadOID(idus); AssemblerUsuario ass = new AssemblerUsuario(); Usuario sol = ass.ConvertENToModelUI(en); int idlist = -1; IList <PeliculaEN> listap = null; IList <SerieEN> listas = null; if (lista == "sig") { idlist = sol.siguiendo; listap = en.Lista.ElementAt(0).Pelicula; listas = en.Lista.ElementAt(0).Serie; } else if (lista == "fav") { idlist = sol.favorito; listap = en.Lista.ElementAt(1).Pelicula; listas = en.Lista.ElementAt(1).Serie; } else if (lista == "visto") { idlist = sol.visto; listap = en.Lista.ElementAt(2).Pelicula; listas = en.Lista.ElementAt(2).Serie; } ListaCEN cenl = new ListaCEN(); PeliculaCEN cenp = new PeliculaCEN(); PeliculaEN enp = cenp.ReadOID(idpro); SerieCEN cens = new SerieCEN(); SerieEN ens = cens.ReadOID(idpro); AssemblerSerie asss = new AssemblerSerie(); IList <Serie> sols = asss.ConvertListENToModel(listas); AssemblerPelicula assp = new AssemblerPelicula(); IList <Pelicula> solp = assp.ConvertListENToModel(listap); string tipo = null; Boolean si = false; foreach (Serie linea in sols) { if (linea.id == idpro) { return(RedirectToAction("Details", "Serie", new { id = idpro })); } } foreach (Pelicula linea in solp) { if (linea.id == idpro) { return(RedirectToAction("Details", "Pelicula", new { id = idpro })); } } if (si == false) { IList <int> vamos = new List <int>(); if (enp != null) { vamos.Add(idpro); cenl.Addpel(idlist, vamos); tipo = "Pelicula"; } else { vamos.Add(idpro); cenl.Addserie(idlist, vamos); tipo = "Serie"; } } SessionClose(); return(RedirectToAction("Details", tipo, new { id = idpro })); //return View(sol); }