public async Task <IActionResult> Create([Bind("Id,Name,Email")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Create([Bind("Id,EmployeeId,TaskName,Description")] WorkItem workItem) { if (ModelState.IsValid) { _context.Add(workItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } var employees = await GetEmployees(); ViewBag.Employees = new SelectList(employees, "Id", "Name"); return(View(workItem)); }