MainWindowModel.cs 842 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Runtime.CompilerServices;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace PPC
  9. {
  10. public class Authorization
  11. {
  12. public static Date_Users AuthorizationInSystem(string Login, string Password)
  13. {
  14. List<Date_Users> Users;
  15. Date_Users User;
  16. using (TheBestV2Entities DB = new TheBestV2Entities())
  17. {
  18. Users = DB.Date_Users.Where(a => a.Login == Login && a.Password == Password).ToList();
  19. if (Users.Count != 0) User = Users.ToList().First();
  20. else User = new Date_Users();
  21. User.Users = User.Users;
  22. User.Role = User.Role;
  23. return User;
  24. }
  25. }
  26. }
  27. }