Example #1
0
        public async Task <IActionResult> Create(Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Users.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(users));
        }
Example #2
0
        public async Task <IActionResult> Create(SettUser settUser)
        {
            if (ModelState.IsValid)
            {
                _context.SettUser.Add(settUser);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["SettingId"] = new SelectList(_context.DictSettUser, "Id", "Setting", settUser.SettingId);
            ViewData["UserId"]    = new SelectList(_context.Users, "Id", "User", settUser.UserId);
            return(View(settUser));
        }