public async Task <IActionResult> Create([Bind("ContactId,FirstName,LastName,MiddleName,EmailAddress,MobilePhone,WorkPhone,HomePhone,AddressLine1,AddressLine2,City,StateCode,CountryCode,ZipCode")] Subject subject) { if (ModelState.IsValid) { _context.Add(subject); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(subject)); }
public async Task <IActionResult> Create([Bind("AddressId,ContactId,AddressLine1,AddressLine2,City,State,Country,Zip")] Address address) { if (ModelState.IsValid) { _context.Add(address); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ContactId"] = new SelectList(_context.Subjects, "ContactId", "FirstName", address.ContactId); return(View(address)); }