DocSas/PropertyService.Domain/ModelView/Users/UserProvider.cs
/// <summary>
/// deactivate account as an asynchronous operation.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
deactivate account as an asynchronous operation.
deactivate account as an asynchronous operation .
public async Task<DSCResponse> DeactivateAccountAsync(UserVM user)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            var isSuccess = false;
            var entity = await _appCommon.GetUserAsync(user.Id);
            if (entity != null && entity.IsActive.ToBool())
            {
                var isValid = SecurityManager.VerifyPassword(user.Password, entity.Password);
                if (isValid)
                {
                    entity.IsActive = false;
                    isSuccess = await _userRepo.ModifyAsync(entity);
                }
                else
                {
                    msg.Add("InvalidPassword", "Invalid password");
                }
            }
            else
            {
                msg.Add("AccountNotFound", "Account not found");
            }
            response.ResponseData = isSuccess;
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > DeactivateAccountAsync ( UserVM user ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; var isSuccess = false ; var entity = await _appCommon . GetUserAsync ( user . Id ) ; if ( entity != null && entity . IsActive . ToBool ( ) ) { var isValid = SecurityManager . VerifyPassword ( user . Password , entity . Password ) ; if ( isValid ) { entity . IsActive = false ; isSuccess = await _userRepo . ModifyAsync ( entity ) ; } else { msg . Add ( " " , " " ) ; } } else { msg . Add ( " " , " " ) ; } response . ResponseData = isSuccess ; response . ErrorMessage = msg ; return response ; }
deactivate account as an asynchronous operation.
deactivate account as an asynchronous operation .
None
user
UserVM
None