public async Task <IActionResult> ReturnPaginatedSearchDepartments([FromQuery] SearchDept props) { if (ModelState.IsValid) { var deptList = await _dService.ReturnPagedUserList(props); var retDept = new List <DeptView> { }; retDept = _mapper.Map <List <DeptView> >(deptList); var metaData = new { deptList.TotalCount, deptList.PageSize, deptList.CurrentPage, deptList.TotalPages, deptList.HasNext, deptList.HasPrevious }; var searchResult = new { retDept, metaData }; return(Ok(searchResult)); } return(BadRequest("empty string")); }