DocSas/PropertyService.Domain/ModelView/Users/UserProvider.cs
/// <summary>
/// confirm user as an asynchronous operation.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
confirm user as an asynchronous operation.
confirm user as an asynchronous operation .
public async Task<DSCResponse> ConfirmUserAsync(UserVM user)
        {
            var isOperationSuccess = false;
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            var verResponse = await _appCommon.IsVeriyCodeAsync(user.VericationCodeId, DSCVerifyType.Register);
            if (verResponse.IsSuccess)
            {
                var verCode = verResponse.ResponseData as VerificationCode;
                var userEntity = await _appCommon.GetUserAsync(verCode.UserId);
                if (userEntity != null)
                {
                    var code = await _codeGeneratorProvider.GenerateCodeAsync(DSCCodeType.User);
                    if (code.IsSuccess)
                    {
                        userEntity.IsActive = true;
                        userEntity.ServiceCode = code.ResponseData.ToString();
                        isOperationSuccess = await _userRepo.ModifyAsync(userEntity);
                        response.ResponseData = isOperationSuccess;
                    }
                }
            }
            else
            {
                msg = verResponse.ErrorMessage;
            }
            if (!isOperationSuccess)
            {
               msg.Add("SomethingWrong", "Something went wrong");
            }
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > ConfirmUserAsync ( UserVM user ) { var isOperationSuccess = false ; var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; var verResponse = await _appCommon . IsVeriyCodeAsync ( user . VericationCodeId , DSCVerifyType . Register ) ; if ( verResponse . IsSuccess ) { var verCode = verResponse . ResponseData as VerificationCode ; var userEntity = await _appCommon . GetUserAsync ( verCode . UserId ) ; if ( userEntity != null ) { var code = await _codeGeneratorProvider . GenerateCodeAsync ( DSCCodeType . User ) ; if ( code . IsSuccess ) { userEntity . IsActive = true ; userEntity . ServiceCode = code . ResponseData . ToString ( ) ; isOperationSuccess = await _userRepo . ModifyAsync ( userEntity ) ; response . ResponseData = isOperationSuccess ; } } } else { msg = verResponse . ErrorMessage ; } if ( ! isOperationSuccess ) { msg . Add ( " " , " " ) ; } response . ErrorMessage = msg ; return response ; }
confirm user as an asynchronous operation.
confirm user as an asynchronous operation .
None
user
UserVM
None