public async Task <IActionResult> Edit(int id, [Bind("CompetencePositionID,CompetenceID,PositionID,Level")] CompetencePosition competencePosition) { if (id != competencePosition.CompetencePositionID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(competencePosition); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompetencePositionExists(competencePosition.CompetencePositionID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompetenceID"] = new SelectList(_context.Competence, "CompetenceID", "CompetenceID", competencePosition.CompetenceID); ViewData["PositionID"] = new SelectList(_context.Position, "PositionID", "Name", competencePosition.PositionID); return(View(competencePosition)); }
public async Task <IActionResult> Create([Bind("CompetencePositionID,CompetenceID,PositionID,Level")] CompetencePosition competencePosition) { if (ModelState.IsValid) { _context.Add(competencePosition); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CompetenceID"] = new SelectList(_context.Competence, "CompetenceID", "CompetenceID", competencePosition.CompetenceID); ViewData["PositionID"] = new SelectList(_context.Position, "PositionID", "Name", competencePosition.PositionID); return(View(competencePosition)); }