public async Task<ApiJsonResult> Search(SearchEmployerParams employerParams)
 {
     try
     {
         Tuple<List<User>, int, int> result = await new EmployerManager().Search(employerParams);
         return new ApiJsonPagingResult { Success = true, Data = result.Item1, TotalPages = result.Item2, TotalItems = result.Item3 };
     }
     catch (Exception ex)
     {
         return ProcessException(ex);
     }
 }
        public async Task<Tuple<List<User>, int, int>> Search(SearchEmployerParams employerParams)
        {
            using (AppDbContext context = new AppDbContext())
            {
                var query = context.Users.Include(x => x.Employer).Where(x => x.UserType == UserType.Employer).AsQueryable();

                if (!string.IsNullOrWhiteSpace(employerParams.CompanyName))
                {
                    query = query.Where(x => x.Employer.CompanyName == employerParams.CompanyName);
                }

                int totalItems = await query.CountAsync();
                int totalPages = totalItems / employerParams.PageSize;
                if (totalItems % employerParams.PageSize > 0)
                {
                    totalPages++;
                }

                List<User> users = await query.OrderByDescending(p => p.Employer.CompanyName).Skip(employerParams.PageIndex * employerParams.PageSize).Take(employerParams.PageSize).ToListAsync();
                return new Tuple<List<User>, int, int>(users, totalPages, totalItems);
            }
        }