AuthViewModel.cs 721 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Security.Cryptography;
  4. using ReactiveUI;
  5. using System.Text;
  6. using RegAuth.Models;
  7. using Microsoft.EntityFrameworkCore;
  8. using System.Linq;
  9. namespace RegAuth.ViewModels
  10. {
  11. internal class AuthViewModel : ViewModelBase
  12. {
  13. string _login = "";
  14. string _password = "";
  15. public string Login { get=>_login; set=>_login = value; }
  16. public string Password { get=>_password; set=>_password = value; }
  17. public void AuthUser()
  18. {
  19. byte[] _hashPassword = MD5.HashData(Encoding.ASCII.GetBytes(_password));
  20. User user = MainWindowViewModel.myConnection.Users.Include(x=>x.Roleid).FirstOrDefault(x=>x.Login == _login && x.Password == _hashPassword);
  21. }
  22. }
  23. }