public IActionResult UserSignup(SignupModel userModel) { var result = _signupService.Signup(userModel); if (result > 0) { return(Ok(1)); } return(null); }
public SignupPageViewModel(INavigationService navigationService, ISignupService signupService, IPageDialogService pageDialogService) : base(navigationService) { _signupService = signupService; _pageDialogService = pageDialogService; Title = "サインアップ"; Email = _signupService.Email; Name = _signupService.Name; Password = _signupService.Password; _signupService.Image.Value = "user.png"; _signupService.SignupCompletedNotifier .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => { var navigation = NavigationFactory.Create <MainPageViewModel>() .Add(NavigationNameProvider.DefaultNavigationPageName) .Add <HomePageViewModel>(); return(NavigateAsync(navigation, noHistory: true)); }) .Subscribe() .AddTo(_disposables); _signupService.SignupErrorNotifier .ObserveOn(SynchronizationContext.Current) .Subscribe(_ => _pageDialogService.DisplayAlertAsync("エラー", "サインアップに失敗しました", "OK")) .AddTo(_disposables); _signupService.IsSigningUp .Skip(1) .Where(b => b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => NavigateAsync <LoadingPageViewModel>()) .Subscribe() .AddTo(_disposables); _signupService.IsSigningUp .Skip(1) .Where(b => !b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => GoBackAsync()) .Subscribe() .AddTo(_disposables); SignupCommand = _signupService.CanSignup .ToAsyncReactiveCommand() .AddTo(_disposables); SignupCommand.Subscribe(async() => await _signupService.Signup()); }