public PagedResponse <DomainEntity.Employee> GetEmployee(EmployeeFilterRequest request) { try { var employeeRepository = _unitOfWork.Repository <DbEntity.Employee>(); if (request.Group_id.HasValue) { _filterManager.AddParameter(FilterParameter.CreateBuilder() .SetName("GroupId") .SetType(typeof(int)) .SetValue(request.Group_id.Value) .SetOperation(FilterOperation.Equel) .Build()); } if (!String.IsNullOrEmpty(request.Name)) { _filterManager.AddParameter(FilterParameter.CreateBuilder() .SetName("Name") .SetType(typeof(string)) .SetOperation(FilterOperation.Contains) .SetValue(request.Name) .Build()); } var employeeTable = employeeRepository.Table; int totalCount = _filterManager.ApplyFilter(employeeTable).Cast <DbEntity.Employee>().Count(); var result = _filterManager.ApplyFilter(employeeTable).Cast <DbEntity.Employee>().Skip(request.offset).Take(request.limit).ToList(); PagedResponse <DomainEntity.Employee> response = new PagedResponse <DomainEntity.Employee>(); response.TotalCount = totalCount; if (response.TotalCount > 0) { response.Collection = new List <DomainEntity.Employee>(); response.Collection.AddRange(_mapper.Map <IEnumerable <DbEntity.Employee>, IEnumerable <DomainEntity.Employee> >(result)); } return(response); } catch (Exception ex) { // Error logic // .... throw new Exception(ex.Message, ex); } }