public async Task <IActionResult> Edit(int id, [Bind("ResearchId,ThemeId")] ResearchTheme researchTheme) { if (id != researchTheme.ResearchId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(researchTheme); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResearchThemeExists(researchTheme.ResearchId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ResearchId"] = new SelectList(_context.Research, "Id", "Name", researchTheme.ResearchId); ViewData["ThemeId"] = new SelectList(_context.Theme, "Id", "Name", researchTheme.ThemeId); return(View(researchTheme)); }
public async Task <IActionResult> Create([Bind("ResearchId,ThemeId")] ResearchTheme researchTheme) { if (ModelState.IsValid) { _context.Add(researchTheme); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ResearchId"] = new SelectList(_context.Research, "Id", "Name", researchTheme.ResearchId); ViewData["ThemeId"] = new SelectList(_context.Theme, "Id", "Name", researchTheme.ThemeId); return(View(researchTheme)); }