public bool CreateEmployee(EmployeeRegisterBindingModel employeeModel)
        {
            using (this.employeeRepository)
            {
                bool isUserWithSameUsernameExisting = this.employeeRepository.IsUserWithSameUsernameExisting(employeeModel.Username);
                if (isUserWithSameUsernameExisting)
                {
                    return(false);
                }

                string passwordSalt          = PasswordUtilities.GeneratePasswordSalt();
                string passwordHash          = PasswordUtilities.GeneratePasswordHash(employeeModel.Password, passwordSalt);
                EmployeeCreateModel employee = new EmployeeCreateModel(employeeModel.Username, employeeModel.Name, passwordHash, passwordSalt, employeeModel.BirthDate);

                bool createEmployeeResult = this.employeeRepository.CreateEmployee(employee);
                return(createEmployeeResult);
            }
        }
        public ActionResult Register(EmployeeRegisterBindingModel employeeModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(employeeModel));
            }

            bool registerResult = this.employeeManager.CreateEmployee(employeeModel);

            if (!registerResult)
            {
                this.TempData.Add(TempDataErrorMessageKey, ExistingUsernameError);
                return(this.View(employeeModel));
            }

            this.TempData.Add(TempDataSuccessMessageKey, RegistrationSuccessful);
            return(RedirectToAction(nameof(EmployeesController.Login), Employees));
        }