public async Task <User> RegisterEmployee(UserForRegisterEmployeeDto userForRegisterEmployeeDto)
        {
            var userToCreate = this.mapper.Map <User>(userForRegisterEmployeeDto); // Map a user from the recived dto

            userToCreate.Created = DateTime.Now;
            var result = await this.userManager.CreateAsync(userToCreate, "password"); // set "password" as default password

            if (result.Succeeded)
            {
                // Create a list of roles form ·"userToCreate" containing "Employee" too
                List <string> roleNames = new List <string>();
                roleNames.Add("Employee");
                if (userForRegisterEmployeeDto.RoleNames != null)
                {
                    foreach (var role in userForRegisterEmployeeDto.RoleNames)
                    {
                        roleNames.Add(role);
                    }
                }
                // Assign the list of roles to the new user to make it an employee
                var userCreated = userManager.FindByEmailAsync(userForRegisterEmployeeDto.Email).Result;
                result = await userManager.AddToRolesAsync(userCreated, roleNames);

                if (result.Succeeded)
                {
                    return(userCreated);
                }
                // ToDo: Return not only the code, but also the route where the user is available
                // ToDo: Return the user with the response too, mapped to a userForDetailedDto -> v.204
            }

            return(null);
        }
        public async Task <IActionResult> RegisterEmployee(UserForRegisterEmployeeDto userForRegisterEmployeeDto)
        {
            var user = await this.repo.RegisterEmployee(userForRegisterEmployeeDto);

            if (user != null)
            {
                return(StatusCode(201));
                // ToDo: Return not only the code, but also the route where the user is available
                // ToDo: Return the user with the response too, mapped to a userForDetailedDto -> v.204
            }

            return(BadRequest("Not possible to register the user. Try with another email."));
        }