public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] Building building) { if (id != building.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(building); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuildingExists(building.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(building)); }
public async Task <IActionResult> Edit(int id, [Bind("Population,Id,Name,Description")] 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("PostId,Title,Content,BlogId")] Post post) { if (id != post.PostId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(post); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostExists(post.PostId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BlogId"] = new SelectList(_context.Blogs, "BlogId", "BlogId", post.BlogId); return(View(post)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FeatureName,FeatureDescription,Active,Combat")] ClassFeature classFeature) { if (id != classFeature.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(classFeature); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassFeatureExists(classFeature.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(classFeature)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ClassName,HitDice,Level,Features")] ClassLevel classLevel) { if (id != classLevel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(classLevel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassLevelExists(classLevel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(classLevel)); }