WPF MVVM login form

Hi, who can please advise with WPF MVVM I'm making an authorization form, I wrote a model where there is : public int Id { get; set; } public string Login { get; set; } = null!; public string Password { get; set; } = null!; The service that goes to the repository and requests data: (I made the service because there I want to do validation, and for example even hashing of the entered password): public class UserService : IUserService { private readonly IUserRepository _userRepository; public UserService(IUserRepository userRepository) { _userRepository = userRepository; } public async Task<User?> GetUserByLogPassAsync(string login, string password) { var result = await _userRepository.GetUserByLogPassAsync(login, password); return result; } But I can't figure out how to call this service in viewModel and for example go to another form if login and password are correct: public class LoginViewModel : ViewModelBase { private readonly IUserService _userService; private string _login; private string _password; public string Login { get { return _login; } set { _login = value; OnPropertyChenged(nameof(Login)); } } public string Password { get { return _password; } set { _password = value; OnPropertyChenged(nameof(Password)); } } public ICommand LoginCommand { get; }
0 Replies
No replies yetBe the first to reply to this messageJoin