AuthorizationUserControlPresenter.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using OOO_WriteAndClear.DBModels;
  2. using OOO_WriteAndClear.MVP.Models;
  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.Presenters
  10. {
  11. class AuthorizationUserControlPresenter : IAuthorizationContract.IPresenter
  12. {
  13. public AuthorizationUserControlPresenter(IAuthorizationContract.IView view)
  14. {
  15. _view = view;
  16. _model = new AuthorizationUserControlModel();
  17. }
  18. public void CheckTheUser(string login, string password)
  19. {
  20. User? userID;
  21. userID = _model.AuthorizationUserInSystem(login, password);
  22. if(userID is null)
  23. {
  24. _view.ShowFailureAuthorizeMessage();
  25. return;
  26. }
  27. _view.LetInAuthorizedUser(userID);
  28. }
  29. private readonly IAuthorizationContract.IView _view;
  30. private readonly IAuthorizationContract.IModel _model;
  31. }
  32. }