public async Task <IActionResult> Edit(int id, [Bind("Id,Address")] Client client) { if (id != client.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(client)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Slung")] City city) { if (id != city.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(city); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityExists(city.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(city)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,EventDate,Description,Picture,People,Duration,CityId")] Event @event) { if (id != @event.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@event); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventExists(@event.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Name", @event.CityId); return(View(@event)); }