Beispiel #1
0
 public Entity.ActionStatus AdminLogin(Entity.LoginRequest request)
 {
     Entity.ActionStatus result = new ActionStatus(true);
     try
     {
         Model.AdminUser adminUser = _adminUserRepository.AdminLogin(request);
         if (adminUser == null)
         {
             result.Success = false;
             result.Message = "No User Found!";
         }
         else if (adminUser == null || !adminUser.Password.Equals(request.Password))
         {
             result.Success = false;
             result.Message = "Invalid credentials.";
         }
         else if (adminUser != null && (!adminUser.IsActive || adminUser.IsDeleted))
         {
             result.Success = false;
             result.Message = "Your account has been deactivated.";
         }
         else
         {
             result.Success = true;
             result.Data    = adminUser;
         }
     }
     catch (Exception ex)
     {
         result.Success = false;
         _logger.Error(Constants.ACTION_EXCEPTION, $"UserManager.Login {ex.Message}");
     }
     return(result);
 }
 public Entity.ActionStatus AdminLogin(Entity.LoginRequest request)
 {
     Entity.ActionStatus result = new ActionStatus(true);
     try
     {
         Model.AdminUser adminUser = _adminUserRepository.AdminLogin(request);
         if (adminUser == null)
         {
             result.Success = false;
             result.Message = "No User Found!";
         }
         else if (adminUser == null || !adminUser.Password.Equals(request.Password))
         {
             result.Success = false;
             result.Message = "Invalid credentials.";
         }
         else if (adminUser != null && (!adminUser.IsActive || adminUser.IsDeleted))
         {
             result.Success = false;
             result.Message = "Your account has been deactivated.";
         }
         else
         {
             result.Success = true;
             result.Data    = adminUser;
         }
     }
     catch (Exception ex)
     {
         result.Success = false;
         _logger.ErrorLog(ex, this.GetType().Name, MethodBase.GetCurrentMethod().Name);
     }
     return(result);
 }