// // GET: /Articulo/Delete/5 public ActionResult Delete(int id) { try { // TODO: Add delete logic here int idCategoria = -1; SessionInitialize(); ArticuloCAD artCAD = new ArticuloCAD(session); ArticuloCEN cen = new ArticuloCEN(artCAD); ArticuloEN artEN = cen.ReadOID(id); Ruta art = new AssemblerArticulo().ConvertENToModelUI(artEN); idCategoria = art.IdCategoria; SessionClose(); new ArticuloCEN().Destroy(id); return RedirectToAction("PorCategoria", new {id=idCategoria}); } catch { return View(); } }
// GET: /Articulo/Categoria/5 public ActionResult PorCategoria(int id) { SessionInitialize(); ArticuloCAD cadArt = new ArticuloCAD(session); CategoriaCAD cadCat = new CategoriaCAD(session); ArticuloCEN cen = new ArticuloCEN(cadArt); IList<ArticuloEN> listArtEn = cen.DameArticulosPorCat(id); IEnumerable<Ruta> listArt = new AssemblerArticulo().ConvertListENToModel(listArtEn).ToList(); CategoriaEN catEN = cadCat.ReadOIDDefault(id); ViewData["IdCategoria"] = id; if (catEN != null) ViewData["NombreCategoria"] = catEN.Nombre; SessionClose(); return View(listArt); }
// // GET: /Articulo/Edit/5 public ActionResult Edit(int id) { Ruta art = null; SessionInitialize(); ArticuloEN artEN = new ArticuloCAD(session).ReadOIDDefault(id); art = new AssemblerArticulo().ConvertENToModelUI(artEN); SessionClose(); return View(art); }