AuthorizationUserControlModel.cs 866 B

1234567891011121314151617181920212223242526272829
  1. using Microsoft.EntityFrameworkCore;
  2. using OOO_WriteAndClear.DBModels;
  3. using OOO_WriteAndClear.MVP.MVPInterfaces;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace OOO_WriteAndClear.MVP.Models
  10. {
  11. public class AuthorizationUserControlModel : IAuthorizationContract.IModel
  12. {
  13. public AuthorizationUserControlModel()
  14. {
  15. }
  16. public User? AuthorizationUserInSystem(string login, string password)
  17. {
  18. User? user;
  19. using (VorobiewTradeContext DB = new VorobiewTradeContext())
  20. return user = DB.Users.Include(a => a.UserRoleNavigation)
  21. .Where(a => a.UserLogin == login && a.UserPassword == password)
  22. .FirstOrDefault();
  23. }
  24. }
  25. }