コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Country,Recommendation")] LocationModel locationModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(locationModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(locationModel));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Username,Email,Password")] UserModel userModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userModel));
        }
コード例 #3
0
        public async Task <IActionResult> Signup(UserModel user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(Redirect("Login"));
            }

            return(View(user));
        }