public async Task <IActionResult> Edit(int id, [Bind("AanbiederId,Name")] Aanbieder aanbieder) { if (id != aanbieder.AanbiederId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(aanbieder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AanbiederExists(aanbieder.AanbiederId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(aanbieder)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryId,Name")] Category category) { if (id != category.CategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("EventId,Name,Description,Location,Full,CategoryId,AanbiederId")] Event @event) { if (id != @event.EventId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@event); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventExists(@event.EventId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AanbiederId"] = new SelectList(_context.Set <Aanbieder>(), "AanbiederId", "AanbiederId", @event.AanbiederId); ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryId", @event.CategoryId); return(View(@event)); }