public IActionResult Create([Bind("Id,UserName,Position")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public IActionResult Create([Bind("Id,ProjectTitle,Budget,CompletionDate")] Project project) { if (ModelState.IsValid) { _context.Add(project); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(project)); }
public IActionResult Create([Bind("Id,TaskTitle,EstimatedNumberOfDays,ActualNumberOfDays,ProjectId,EmployeeId")] ProjectTask projectTask) { if (ModelState.IsValid) { _context.Add(projectTask); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "Id", projectTask.EmployeeId); ViewData["ProjectId"] = new SelectList(_context.Project, "Id", "Id", projectTask.ProjectId); return(View(projectTask)); }