public async Task <IActionResult> Edit(int id, [Bind("Id,Edad,MailAcom,NIdAcom,PApe,ParPac,PNom,SApe,SNom,TelAcom,TipoIdId,PacienteId")] Acompanantes acompanantes) { if (id != acompanantes.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(acompanantes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AcompanantesExists(acompanantes.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PacienteId"] = new SelectList(_context.Pacientes, "Id", "CiuRes", acompanantes.PacienteId); ViewData["TipoIdId"] = new SelectList(_context.Tiposid, "Id", "NomTipo", acompanantes.TipoIdId); return(View(acompanantes)); }
public async Task <IActionResult> Create([Bind("Id,Edad,MailAcom,NIdAcom,PApe,ParPac,PNom,SApe,SNom,TelAcom,TipoIdId,PacienteId")] Acompanantes acompanantes) { if (ModelState.IsValid) { _context.Add(acompanantes); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PacienteId"] = new SelectList(_context.Pacientes, "Id", "CiuRes", acompanantes.PacienteId); ViewData["TipoIdId"] = new SelectList(_context.Tiposid, "Id", "NomTipo", acompanantes.TipoIdId); return(View(acompanantes)); }