示例#1
0
        public async Task <IActionResult> Create([Bind("TaskID,ProjectID,TaskName,TaskDescription,TaskStartDate,TaskDeadline,Completed")] Tasks tasks)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tasks);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Projects", new { id = tasks.ProjectID }));
            }
            return(View(tasks));
        }
示例#2
0
        public async Task <IActionResult> Create(BugTrackerUser bt, [Bind("ProjectID,UserID,ProjectName,ProjectDescription,ProjectDate")] Projects projects)
        {
            if (ModelState.IsValid)
            {
                projects.UserID = _userManager.GetUserId(User);
                _context.Add(projects);
                await _context.SaveChangesAsync();

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