예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }