Ejemplo n.º 1
0
        public virtual async Task <AppUser_Dto> RegisterAsync(RegisterDto input)
        {
            await CheckSelfRegistrationAsync();

            var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);

            (await UserManager.CreateAsync(user, input.Password)).CheckErrors();

            await UserManager.SetEmailAsync(user, input.EmailAddress);

            await UserManager.AddDefaultRolesAsync(user);

            var appUser = await AppUserRepo.GetAsync(x => x.Id == user.Id);

            appUser.EmployeeId = input.EmployeeId;

            var result = await AppUserRepo.UpdateAsync(appUser);

            return(ObjectMapper.Map <AppUser, AppUser_Dto>(result));
        }