Beispiel #1
0
        public async Task <(bool success, string errorMessage)> InstallAsync(string userName, string password, string email, string mobile)
        {
            try
            {
                await SyncDatabaseAsync();

                var administrator = new Administrator
                {
                    UserName = userName,
                    Email    = email,
                    Mobile   = mobile
                };

                await AdministratorRepository.InsertAsync(administrator, password);

                await AdministratorRepository.AddUserToRoleAsync(userName, PredefinedRole.ConsoleAdministrator.GetValue());

                await UserMenuRepository.ResetAsync();

                return(true, string.Empty);
            }
            catch (Exception ex)
            {
                return(false, ex.Message);
            }
        }