private async Task GetUserRole() { List <string> userRole = await _apiHelper.GetUserId(_loggedInUserModel.Token); _loggedInUserModel.Role = userRole[1]; NotifyOfPropertyChange(() => IsAdmin); }
public async Task Submit() { dynamic settings = new ExpandoObject(); settings.WindowStartupLocationLocation = WindowStartupLocation.CenterOwner; settings.ResizeMode = ResizeMode.NoResize; try { RegisterModel registerModel = new RegisterModel { Email = Email, Password = Password, ConfirmPassword = ConfirmPassword }; //string createSuccess = await _apiHelper.RegisterUser(Email, Password, ConfirmPassword); string createSuccess = await _apiHelper.RegisterUser(registerModel); if (createSuccess == "success") { var result = await _apiHelper.Authenticate(Email, Password); UserModel user = new UserModel(); List <string> UInfor = await _apiHelper.GetUserId(result.Access_Token); user.Id = UInfor[0]; user.FirstName = FirstName; user.LastName = LastName; user.EmailAddress = Email; user.CreatedDate = DateTime.Now; await _apiHelper.PostUserInfo(user); settings.Title = "System Message"; _status.UpdateMessage("Account Created Successfully", $"{FirstName} Thank you for joining us!"); await _window.ShowDialogAsync(_status, null, settings); await _events.PublishOnUIThreadAsync(new LogInEvent()); } } catch (Exception ex) { settings.Title = "System Error"; _status.UpdateMessage("Fatal Exception", ex.Message); _window.ShowDialogAsync(_status, null, settings); } }