private async Task <PortalActionResult> CreateUserAndAddUserAsPortalAdminAsync(ZohoContact contact, int companyId) { bool isSuccess = false; string message; var now = DateTime.Now; var tempuser = new ApplicationUser() { UserName = contact.Email, Email = contact.Email, LastPasswordChangedDate = now, CreationDate = now, CompanyId = companyId }; var result = await _userManager.CreateAsync(tempuser, _tempPassword); if (result.Succeeded) { var roleResult = await _userManager.AddToRoleAsync(tempuser, DefaultRoleName); var userContact = await _userManager.CreateUserZohoContactAsync(new UserZohoContact { UserId = tempuser.Id, ZohoContactId = contact.ContactID }); if (roleResult.Succeeded) { isSuccess = true; message = $"User Created for:{tempuser.UserName}"; } else { message = roleResult.ToString(); } } else { message = result.ToString(); } return(new PortalActionResult { IsSuccess = isSuccess, Message = message }); }