Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }