// // GET: /Persona/ public ActionResult Index() { PersonaComponent personaComponent = new PersonaComponent(); return(View(personaComponent.Read())); }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here Persona persona = new Persona(); PersonaComponent personaComponent = new PersonaComponent(); persona.Id = id; persona.cuil = collection.Get("cuil"); persona.email = collection.Get("email"); persona.telefono = collection.Get("telefono"); persona.tipoPersona.Id = int.Parse(collection.Get("tipoPersona.tipoPersona")); if (personaComponent.Update(persona)) { return(RedirectToAction("Index")); } else { return(RedirectToAction("ErrorPage", new { id = persona.Id })); } } catch (Exception e) { return(View()); } }
// // 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: /DireccionPersona/Create public ActionResult Create(int id) { DireccionPersona persona = new DireccionPersona(); PersonaComponent personaComponent = new PersonaComponent(); persona.persona = personaComponent.ReadBy(id); return(View(persona)); }
// // GET: /DireccionPersona/ public ActionResult Index(int id) { DireccionPersona persona = new DireccionPersona(); DireccionPersonaComponent direccionPersona = new DireccionPersonaComponent(); PersonaComponent personaComponent = new PersonaComponent(); persona.direccionPersona = direccionPersona.ReadByPersona(id); persona.persona = personaComponent.ReadBy(id); return(View(persona)); }
// // GET: /DireccionPersona/Delete/5 public ActionResult Delete(int id, int dni) { DireccionPersona persona = new DireccionPersona(); PersonaComponent personaComponent = new PersonaComponent(); persona.persona = personaComponent.ReadBy(dni); DireccionComponent direccion = new DireccionComponent(); persona.direccion = direccion.ReadBy(id); return(View(persona)); }
// // GET: /TipoPersonaPersona/ public ActionResult Index(int id) { TipoPersonaPersonaComponent tipoPersonaPersonaComponent = new TipoPersonaPersonaComponent(); TipoPersonaPersona tipoPersonaPersona = new TipoPersonaPersona(); tipoPersonaPersona.tipoPersonaPersona = tipoPersonaPersonaComponent.Read(id); PersonaComponent personaComponent = new PersonaComponent(); tipoPersonaPersona.persona = personaComponent.ReadBy(id); return(View(tipoPersonaPersona)); }
public Boletin ReadBy(Boletin entity) { BoletinDAC asistenciaDAC = new BoletinDAC(); Boletin result = null; PersonaComponent personaComponent = new PersonaComponent(); result = asistenciaDAC.ReadBy(entity); return(result); }
public ActionResult Delete(int id, FormCollection collection) { try { PersonaComponent personaComponent = new PersonaComponent(); personaComponent.Delete(id); // TODO: Add delete logic here return(RedirectToAction("Index")); } catch (Exception e) { return(View()); } }
public TipoPersonaPersona ObtenerTipoDisponible(int id) { TipoPersonaPersona tipoPersonaPersona = new TipoPersonaPersona(); List <TipoPersona> tipoPersonaPersonaBase = new List <TipoPersona>(); TipoPersonaPersona result = new TipoPersonaPersona(); TipoPersonaComponent tipoPersona = new TipoPersonaComponent(); PersonaComponent personaComponent = new PersonaComponent(); tipoPersonaPersona.tipoPersonaPersona = Read(id); tipoPersonaPersonaBase = tipoPersona.Read(); foreach (TipoPersona subItem in tipoPersonaPersonaBase) { TipoPersonaPersona tipo = new TipoPersonaPersona(); int a = 0; foreach (TipoPersonaPersona item in tipoPersonaPersona.tipoPersonaPersona) { tipo = item; if (subItem.Id == item.tipoPersona.Id) { a = 1; } } if (a == 0) { result.listaTipoPersona.Add(subItem); } } TipoPersonaPersona resultado = new TipoPersonaPersona(); resultado.persona = personaComponent.ReadBy(id); foreach (TipoPersona item in result.listaTipoPersona) { TipoPersonaPersona tipo = new TipoPersonaPersona(); tipo.tipoPersona = item; resultado.tipoPersonaPersona.Add(tipo); } return(resultado); }
// // GET: /Persona/Edit/5 public ActionResult Edit(int id) { Persona persona = new Persona(); TipoPersonaComponent personaComponent = new TipoPersonaComponent(); PersonaComponent component = new PersonaComponent(); persona = component.ReadBy(id); persona.listaTipoPersona = personaComponent.Read(); persona.listaTipoPersona.Select(y => new { y.Id, y.tipoPersona }); ViewBag.RolesLista = new SelectList(persona.listaTipoPersona, "Id", "tipoPersona"); return(View(persona)); }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here Persona persona = new Persona(); PersonaComponent personaComponent = new PersonaComponent(); persona.usuarios.Nombre = collection.Get("usuarios.Nombre"); persona.usuarios.Apellido = collection.Get("usuarios.Apellido"); persona.usuarios.Password = collection.Get("usuarios.Password"); persona.usuarios.Email = collection.Get("email"); persona.Id = int.Parse(collection.Get("Id")); persona.cuil = collection.Get("cuil"); persona.email = collection.Get("email"); persona.telefono = collection.Get("telefono"); persona.tipoPersona.Id = int.Parse(collection.Get("tipoPersona.tipoPersona")); persona.Direccion.direccion = collection.Get("Direccion.direccion"); persona.Direccion.numero = int.Parse(collection.Get("Direccion.numero")); persona.Direccion.piso = int.Parse(collection.Get("Direccion.piso")); persona.Direccion.departamento = collection.Get("Direccion.departamento"); persona.Direccion.codigoPostal = int.Parse(collection.Get("Direccion.codigoPostal")); persona.Direccion.localidad = collection.Get("Direccion.localidad"); persona.Direccion.provincia = collection.Get("Direccion.provincia"); Persona resul = new Persona(); resul = personaComponent.Create(persona); if (resul == null) { return(RedirectToAction("ErrorPage", new { id = persona.Id })); } else { return(RedirectToAction("Index")); } } catch (Exception e) { return(View()); } }
public List <TipoPersonaPersona> Read(int id) { TipoPersonaPersonaDAC tipoPersonaPersonaDAC = new TipoPersonaPersonaDAC(); List <TipoPersonaPersona> tipoPersonaPersonas = new List <TipoPersonaPersona>(); List <TipoPersonaPersona> result = new List <TipoPersonaPersona>(); tipoPersonaPersonas = tipoPersonaPersonaDAC.Read(id); foreach (TipoPersonaPersona item in tipoPersonaPersonas) { TipoPersonaPersona tipoPersonaPersona = new TipoPersonaPersona(); PersonaComponent personaComponent = new PersonaComponent(); TipoPersonaComponent tipoPersonaComponent = new TipoPersonaComponent(); tipoPersonaPersona.tipoPersona = tipoPersonaComponent.ReadBy(item.tipoPersona.Id); tipoPersonaPersona.persona = personaComponent.ReadBy(item.persona.Id); result.Add(tipoPersonaPersona); } return(result); }
// // GET: /Persona/Details/5 public ActionResult ErrorPage(int id) { PersonaComponent personaComponent = new PersonaComponent(); return(View(personaComponent.ReadBy(id))); }