public async Task <IActionResult> Edit(int id, [Bind("Id,Birthdate,GenderId,Name,Patronymic,Surname")] qvUserPassport qvUserPassport) { if (id != qvUserPassport.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(qvUserPassport); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!qvUserPassportExists(qvUserPassport.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["GenderId"] = new SelectList(_context.Genders, "Id", "Gender", qvUserPassport.GenderId); return(View(qvUserPassport)); }
public async Task <IActionResult> Create([Bind("Id,Birthdate,GenderId,Name,Patronymic,Surname")] qvUserPassport qvUserPassport) { if (ModelState.IsValid) { _context.Add(qvUserPassport); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["GenderId"] = new SelectList(_context.Genders, "Id", "Gender", qvUserPassport.GenderId); return(View(qvUserPassport)); }