public async Task <IActionResult> Create([Bind("LevelId,Position")] Level level) { if (ModelState.IsValid) { _context.Add(level); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(level)); }
public async Task <IActionResult> Create([Bind("MenteeId,LevelId,MenteeName,Age")] Mentee mentee) { if (ModelState.IsValid) { _context.Add(mentee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LevelId"] = new SelectList(_context.Set <Level>(), "LevelId", "LevelId", mentee.LevelId); return(View(mentee)); }