public async Task <IUser> GetUser(string userId) { try { var userDataModel = await _userDataManager.GetUserAsync(userId); var user = new User(userDataModel, _userDataManager); return(user); } catch (UserNotFoundDataException) { throw new UserNotFoundException(); } }
public async Task SaveAsync() { try { if (_isNew) { UserDataModel userDataModel = Converter.Convert <UserDataModel, User>(this); await _userDataManager.RegisterUserAsync(userDataModel, _password); userDataModel = await _userDataManager.GetUserAsync(UserName, _password); UserId = userDataModel.UserId; _isNew = false; } await _userInfo.SaveAsync(); } catch (UserNotFoundDataException) { throw new UserNotFoundException(); } catch (UserRegisterDataException) { throw new UserRegisterException(); } }