public async Task <IActionResult> Create([Bind("Id,Name")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Street,City,State,PostalCode,EmailAddress,PrimaryPhoneNumber,SecondaryPhoneNumber,DepartmentId")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } PopulateDepartmentsDropDownList(employee); return(View(employee)); }