public async Task <IActionResult> Edit(string id, [Bind("ProfileCode,CompetenceId")] ProfileCompetence profileCompetence) { if (id != profileCompetence.ProfileCode) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(profileCompetence); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfileCompetenceExists(profileCompetence.ProfileCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompetenceId"] = new SelectList(_context.Competence, "Id", "Code", profileCompetence.CompetenceId); ViewData["ProfileCode"] = new SelectList(_context.Profile, "Code", "Code", profileCompetence.ProfileCode); return(View(profileCompetence)); }
public async Task <IActionResult> AddProfileCompetence([Bind("ProfileCode,CompetenceId")] ProfileCompetence profileCompetence) { if (ModelState.IsValid) { _context.Add(profileCompetence); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Edit), new { id = profileCompetence.ProfileCode })); } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create([Bind("ProfileCode,CompetenceId")] ProfileCompetence profileCompetence) { if (ModelState.IsValid) { _context.Add(profileCompetence); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CompetenceId"] = new SelectList(_context.Competence, "Id", "Code", profileCompetence.CompetenceId); ViewData["ProfileCode"] = new SelectList(_context.Profile, "Code", "Code", profileCompetence.ProfileCode); return(View(profileCompetence)); }