public virtual async Task<BaseInfoResponse> GetBasicUserInformation(string targetUser) { BaseInfoResponse response = null; var result = await Task.Factory.StartNew(() => Client.UserService.getUserInfo(targetUser, null)).ConfigureAwait(false); if (result.UserId > 0) { response = new BaseInfoResponse { UserId = Convert.ToInt32(result.UserId), UserName = result.UserName, UserTypeId = (SystemUserType)result.UserTypeId, Picture = result.Picture, Title = result.Title, Email = result.Email, FirstName = result.FirstName, LastName = result.LastName }; } return response; }
// SingleData<GeneralKvPair<long, int>> request //public async Task<StatusData<string>> ResetPassword(string resetPasswordCode, string newpassword) //{ // var response = new StatusData<string> { Status = SystemDbStatus.Updated }; // var user = await Task.Factory.StartNew(() => Client.UserService.resetPassword(resetPasswordCode, newpassword)).ConfigureAwait(false); // if (user == null) // { // response.Status = SystemDbStatus.NotFound; // return response; // } // response.Status = (SystemDbStatus)user.DbStatusCode; // response.Message = user.DbStatusMsg; // return response; //} public async Task<StatusData<BaseInfoResponse>> ResetPassword(ResetPasswordRequest request) { var response = new StatusData<BaseInfoResponse> { Status = SystemDbStatus.NotFound }; var user = await Task.Factory.StartNew(() => Client.UserService.resetPassword(request.RequestCode, request.Password)).ConfigureAwait(false); if (user == null) return response; response.Status = (SystemDbStatus)user.DbStatusCode; response.Message = user.DbStatusMsg; if (response.Status.IsOperationSuccessful()) { var result = await Task.Factory.StartNew(() => Client.UserService.getUserInfo(request.UserName, null)).ConfigureAwait(false); if (result.UserId > 0) { var uInfo = new BaseInfoResponse { UserId = Convert.ToInt32(result.UserId), UserName = result.UserName, UserTypeId = (SystemUserType)result.UserTypeId, Picture = result.Picture, Title = result.Title, Email = result.Email, FirstName = result.FirstName, LastName = result.LastName }; response.Data = uInfo; } } return response; }