public async Task <IActionResult> Edit(int id, [Bind("GalleryEntryID,TagID")] GalleryEntry_Tag galleryEntry_Tag) { if (id != galleryEntry_Tag.TagID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(galleryEntry_Tag); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GalleryEntry_TagExists(galleryEntry_Tag.TagID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["GalleryEntryID"] = new SelectList(_context.GalleryEntries, "GalleryEntryID", "Description", galleryEntry_Tag.GalleryEntryID); ViewData["TagID"] = new SelectList(_context.Tags, "TagID", "Name", galleryEntry_Tag.TagID); return(View(galleryEntry_Tag)); }
public async Task <IActionResult> Create([Bind("GalleryEntryID,TagID")] GalleryEntry_Tag galleryEntry_Tag) { if (ModelState.IsValid) { _context.Add(galleryEntry_Tag); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["GalleryEntryID"] = new SelectList(_context.GalleryEntries, "GalleryEntryID", "Description", galleryEntry_Tag.GalleryEntryID); ViewData["TagID"] = new SelectList(_context.Tags, "TagID", "Name", galleryEntry_Tag.TagID); return(View(galleryEntry_Tag)); }