예제 #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            telefono_persona telefono_persona = await db.telefono_persona.FindAsync(id);

            db.telefono_persona.Remove(telefono_persona);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
예제 #2
0
        public async Task <ActionResult> EditTelefono(telefono telefono, telefono_persona telefono_Persona)
        {
            if (ModelState.IsValid)
            {
                db.Entry(telefono).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction(string.Format("Details/{0}", telefono_Persona.personaId)));
            }
            return(View(telefono_Persona));
        }
예제 #3
0
        public async Task <ActionResult> Edit([Bind(Include = "id,personaId,telefonosId")] telefono_persona telefono_persona)
        {
            if (ModelState.IsValid)
            {
                db.Entry(telefono_persona).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.personaId   = new SelectList(db.persona, "id", "dni", telefono_persona.personaId);
            ViewBag.telefonosId = new SelectList(db.telefono, "id", "telefono1", telefono_persona.telefonosId);
            return(View(telefono_persona));
        }
예제 #4
0
        // GET: telefono_persona/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            telefono_persona telefono_persona = await db.telefono_persona.FindAsync(id);

            if (telefono_persona == null)
            {
                return(HttpNotFound());
            }
            return(View(telefono_persona));
        }
예제 #5
0
        // GET: telefono_persona/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            telefono_persona telefono_persona = await db.telefono_persona.FindAsync(id);

            if (telefono_persona == null)
            {
                return(HttpNotFound());
            }
            ViewBag.personaId   = new SelectList(db.persona, "id", "dni", telefono_persona.personaId);
            ViewBag.telefonosId = new SelectList(db.telefono, "id", "telefono1", telefono_persona.telefonosId);
            return(View(telefono_persona));
        }
예제 #6
0
        public async Task <ActionResult> CreateTelefono(telefono telefono, int id)
        {
            if (ModelState.IsValid)
            {
                db.telefono.Add(telefono);
                var telefono_Persona = new telefono_persona {
                    personaId = id, telefonosId = telefono.id
                };

                db.telefono_persona.Add(telefono_Persona);
                await db.SaveChangesAsync();

                return(RedirectToAction(string.Format("Details/{0}", telefono_Persona.personaId)));
            }

            return(View());
        }
예제 #7
0
        // GET: telefonos/Create
        public async Task <ActionResult> CreateTelefono(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            persona persona = await db.persona.FindAsync(id);

            if (persona == null)
            {
                return(HttpNotFound());
            }

            var telefono_personaId = new telefono_persona {
                personaId = persona.id
            };

            return(View(telefono_personaId));
        }