public async Task <IActionResult> Edit(int id, [Bind("UserId,Email,UserPassword")] UserInfo userInfo)
        {
            if (id != userInfo.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserInfoExists(userInfo.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(userInfo));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("TaskNumber,TaskDesc,TaskDueDate,StartDate,TaskStatus,UserId")] TaskInfo taskInfo)
        {
            if (id != taskInfo.TaskNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(taskInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TaskInfoExists(taskInfo.TaskNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.UserInfo, "UserId", "Email", taskInfo.UserId);
            return(View(taskInfo));
        }