public async Task <IActionResult> Create([Bind("UserId,Email,UserPassword")] UserInfo userInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userInfo));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("TaskNumber,TaskDesc,TaskDueDate,StartDate,TaskStatus,UserId")] TaskInfo taskInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(taskInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.UserInfo, "UserId", "Email", taskInfo.UserId);
            return(View(taskInfo));
        }