public NewAccountViewModel(IUserAccountService userAccountService, IMvxNavigationService mvxNavigationService) { _userAccountService = userAccountService; _mvxNavigationService = mvxNavigationService; Model = new UserAccountModel(); this.CreateAccountCommand = ReactiveCommand.CreateFromTask(async() => { Model.Validade(); await _userAccountService.CreateUserAccount(Model); await _mvxNavigationService.Navigate <AccountCreatedViewModel>(); await _mvxNavigationService.Close(this); }, this.WhenAnyValue( x => x.Model.FirstName, x => x.Model.LastName, x => x.Model.Username, x => x.Model.Password, x => x.Model.PhoneNumber, (firstName, lastName, username, password, phoneNumber) => !string.IsNullOrEmpty(Model.FirstName) && !string.IsNullOrEmpty(Model.LastName) && !string.IsNullOrEmpty(Model.Username) && !string.IsNullOrEmpty(Model.Password) && !string.IsNullOrEmpty(Model.PhoneNumber))); }
public Task CreateUserAccount(UserAccountModel user) { user.Validade(); return(_secureStorageService.Set(user.Username, user)); }