Example #1
0
        public async Task ConfigureUserProfile(string username)
        {
            if (_currentUserProfile == null)
            {
                throw new InvalidOperationException("Can't configure the user profile if the current user profile is null.");
            }

            var viewModel = new ConfigureUserProfileViewModel()
            {
                Id       = _currentUserProfile.Id,
                Username = username
            };

            var newUserProfile = await _userDataService.ConfigureUserProfile(viewModel);

            if (newUserProfile != null)
            {
                _currentUserProfile = newUserProfile;
            }
            else
            {
                throw new Exception("Something wrong happened when trying to configure the user.");
            }
        }