コード例 #1
0
        public async Task <IActionResult> Create([Bind("UserId,FirstName,LastName")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ShootingId,NumberOfShoots,CreationDateTime,IsFinished")] Shooting shooting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shooting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shooting));
        }