public async Task <IActionResult> Edit(int id, [Bind("Id,CityName,PostalZip,IsEnabled,CountryId")] 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))); } ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Id", city.CountryId); return(View(city)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,JoinedDate,IsActivated,CityId,Street")] Author author) { if (id != author.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(author); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuthorExists(author.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Id", author.CityId); return(View(author)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CategoryName,Description,IsEnabled")] Category category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BookId,Title,Content,ModifiedDate,ModifiedBy,IsEnabled")] Chapter chapter) { if (id != chapter.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(chapter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChapterExists(chapter.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Id", chapter.BookId); return(View(chapter)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,AuthorId,ModifiedDate,ModifiedBy,IsPublished,CategoryId")] Book book) { if (id != book.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Authors, "Id", "Id", book.AuthorId); ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Id", book.CategoryId); return(View(book)); }