コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Number,FormName,Code,Title,Status")] CustomForm customForm)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customForm);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customForm));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Phone,Email,Address,Role")] User user)
        {
            user.Role = Constants.Client;
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

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