public ActionResult NewEmployeeSetup(NewEmployeeSetupViewModel data) { var newAddress = new Address(); newAddress.Street = data.Street; newAddress.City = data.City; newAddress.State = data.State; newAddress.Zip = data.Zip; _context.Addresses.Add(newAddress); _context.SaveChanges(); var newEmployee = new Employee(); newEmployee.Id = this.User.FindFirstValue(ClaimTypes.NameIdentifier); newEmployee.FirstName = data.FirstName; newEmployee.LastName = data.LastName; newEmployee.AddressId = newAddress.AddressId; _context.Employees.Add(newEmployee); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); }
// GET: Redirect to new employee setup view on first signin public ActionResult NewEmployeeSetup() { var NewEmployeeSetupViewModel = new NewEmployeeSetupViewModel(); return(View(NewEmployeeSetupViewModel)); }