Beispiel #1
0
        public static async Task CreateAsync(UserHelpers usersInterface, InternetAccess internetCheck, string pin = null)
        {
            _internetCheck = internetCheck;

            if (!string.IsNullOrEmpty(pin))
            {
                var result = await Users.TryGetUserAsync(_conn, pin);

                if (string.IsNullOrEmpty(result))
                {
                    throw new NoUserFound();
                }

                await usersInterface.CreateLoggedUserAsync(result);

                _user = result;
            }
            else
            {
                _user = await Users.ReadLoggedUserAsync() ?? throw new UserReadFailed();
            }
        }