public async Task <IActionResult> Edit(int id, [Bind("AdultId,AddressId,InActive,InActiveDate")] AdultMemberAddress adultMemberAddress) { if (id != adultMemberAddress.AdultId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(adultMemberAddress); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdultMemberAddressExists(adultMemberAddress.AdultId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Address, "Id", "AddrLn1", adultMemberAddress.AddressId); ViewData["AdultId"] = new SelectList(_context.AdultMember, "Id", "FirstName", adultMemberAddress.AdultId); return(View(adultMemberAddress)); }
public async Task <IActionResult> Create([Bind("AdultId,AddressId,InActive,InActiveDate")] AdultMemberAddress adultMemberAddress) { if (ModelState.IsValid) { _context.Add(adultMemberAddress); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Address, "Id", "AddrLn1", adultMemberAddress.AddressId); ViewData["AdultId"] = new SelectList(_context.AdultMember, "Id", "FirstName", adultMemberAddress.AdultId); return(View(adultMemberAddress)); }