Esempio n. 1
0
        //
        // GET: /TipoPersonaPersona/Delete/5
        public ActionResult Delete(int id, int tipo)
        {
            TipoPersonaPersona tipoPersonaPersona = new TipoPersonaPersona();
            PersonaComponent   personaComponent   = new PersonaComponent();

            tipoPersonaPersona.persona = personaComponent.ReadBy(id);
            TipoPersonaComponent tipoPersona = new TipoPersonaComponent();

            tipoPersonaPersona.tipoPersona = tipoPersona.ReadBy(tipo);
            return(View(tipoPersonaPersona));
        }
        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);
        }
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         TipoPersonaComponent tipoPersonaComponent = new TipoPersonaComponent();
         TipoPersona          tipoPersona          = new TipoPersona();
         tipoPersona.tipoPersona = collection.Get("tipoPersona");
         tipoPersona.Id          = id;
         if (tipoPersonaComponent.Update(tipoPersona))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             tipoPersona = tipoPersonaComponent.ReadBy(tipoPersona.tipoPersona);
             return(RedirectToAction("ErrorPage", new { id }));
         }
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(FormCollection collection)
 {
     try
     {
         // TODO: Add insert logic here
         TipoPersonaComponent tipoPersonaComponent = new TipoPersonaComponent();
         TipoPersona          tipoPersona          = new TipoPersona();
         tipoPersona.tipoPersona = collection.Get("tipoPersona");
         if (tipoPersonaComponent.Create(tipoPersona) is null)
         {
             tipoPersona = tipoPersonaComponent.ReadBy(tipoPersona.tipoPersona);
             return(RedirectToAction("ErrorPage", new { id = tipoPersona.Id }));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e)
     {
         return(View());
     }
 }
        //
        // GET: /TipoPersona/Edit/5
        public ActionResult Edit(int id)
        {
            TipoPersonaComponent tipoPersonaComponent = new TipoPersonaComponent();

            return(View(tipoPersonaComponent.ReadBy(id)));
        }