public async Task <IActionResult> Edit(int id, [Bind("WardMemberId,Fname,Lname,FkCallingId")] WardMember wardMember) { if (id != wardMember.WardMemberId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(wardMember); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WardMemberExists(wardMember.WardMemberId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["FkCallingId"] = new SelectList(_context.Calling, "CallingId", "CallingName", wardMember.FkCallingId); return(View(wardMember)); }
public async Task <IActionResult> Create([Bind("WardMemberId,Fname,Lname,FkCallingId")] WardMember wardMember) { if (ModelState.IsValid) { _context.Add(wardMember); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["FkCallingId"] = new SelectList(_context.Calling, "CallingId", "CallingName", wardMember.FkCallingId); return(View(wardMember)); }