public async Task <IActionResult> Edit(int id, [Bind("Id,CountryID,Name")] qvCity qvCity) { if (id != qvCity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(qvCity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!qvCityExists(qvCity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Details", "qvCountries", new { id = qvCity.CountryID })); } ViewData["CountryID"] = new SelectList(_context.Countries, "Id", "Name", qvCity.CountryID); return(View(qvCity)); }
public async Task <IActionResult> Create([Bind("Id,CountryID,Name")] qvCity qvCity) { if (ModelState.IsValid) { _context.Add(qvCity); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "qvCountries", new { id = qvCity.CountryID })); } ViewData["CountryID"] = new SelectList(_context.Countries, "Id", "Name", qvCity.CountryID); return(View(qvCity)); }