// // GET: /EquipoCliente/Create public ActionResult Create(int id) { EquipoCliente equipoCliente = new EquipoCliente(); PersonaComponent personaComponent = new PersonaComponent(); MarcaComponent marcaComponent = new MarcaComponent(); TipoEquipoComponent tipoEquipo = new TipoEquipoComponent(); equipoCliente.persona = personaComponent.ReadBy(id); equipoCliente.listaMarca = marcaComponent.Read(); equipoCliente.listaTipoEquipo = tipoEquipo.Read(); equipoCliente.listaMarca.Select(y => new { y.Id, y.marca } ); ViewBag.listaMarca = new SelectList(equipoCliente.listaMarca, "Id", "marca"); equipoCliente.listaTipoEquipo.Select(y => new { y.Id, y.tipoEquipo } ); ViewBag.listaTipoEquipo = new SelectList(equipoCliente.listaTipoEquipo, "Id", "tipoEquipo"); return(View(equipoCliente)); }
// GET: /Marca/Edit/5 public ActionResult Edit(int id) { MarcaComponent marcaComponent = new MarcaComponent(); return(View(marcaComponent.ReadBy(id))); }
// GET: /Marca/ public ActionResult Index() { MarcaComponent marcaComponent = new MarcaComponent(); return(View(marcaComponent.Read())); }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here MarcaComponent marcaComponent = new MarcaComponent(); marcaComponent.Delete(id); return(RedirectToAction("Index")); } catch (Exception e) { return(View()); } }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here Marca marca = new Marca(); marca.marca = collection.Get("marca"); MarcaComponent marcaComponent = new MarcaComponent(); if (marcaComponent.Create(marca) == null) { return(RedirectToAction("errorpage", new { id = marcaComponent.ReadBy(marca.marca).Id })); } else { return(RedirectToAction("Index")); } } catch (Exception e) { return(View()); } }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here Marca marca = new Marca(); marca.marca = collection.Get("marca"); marca.Id = id; MarcaComponent marcaComponent = new MarcaComponent(); if (marcaComponent.Update(marca)) { return(RedirectToAction("Index")); } else { return(RedirectToAction("errorpage", new { id = marcaComponent.ReadBy(marca.marca).Id })); } } catch (Exception e) { return(View()); } }