예제 #1
0
        public async Task <IActionResult> Create([Bind("UserId,Email,Password")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Todos"));
            }
            return(View(user));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("TaskID,Description,DueDate,Complete,UserID")] Todo todo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(todo);
                await _context.SaveChangesAsync();

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