public async Task <PaginationResponse> GetHomepasses([FromBody] PaginationRequest paginationRequest) { try { var recordCount = await _homepassService.GetHomepassesCount(paginationRequest?.Filter); var sortOrder = SortOrder.Descending; if (!string.IsNullOrEmpty(paginationRequest?.Order?.OrderByProperty)) { sortOrder = paginationRequest.Order.SortOrder; } var homepasses = await _homepassService.GetHomepasses(paginationRequest?.Filter, paginationRequest?.Order?.OrderByProperty, sortOrder, paginationRequest?.Page, paginationRequest?.PageSize); return(new PaginationResponse { Status = "Ok", Data = homepasses, RecordCount = recordCount }); } catch (Exception ex) { _logger?.LogError(ex, "Error fetching homepasses."); return(new PaginationResponse { Status = "Error", Message = "Error fetching homepasses." }); } }
public async Task <ResponseMessage> GetHomepassesInCluster(string clusterId) { try { var cluster = await _clusterService.GetCluster(clusterId); //var homepass = await _homepassService.GetHomepassesInCluster(cluster.Geometry); var homepasses = await _homepassService.GetHomepasses(cluster.Homepasses); return(new ResponseMessage { Status = "Ok", Data = homepasses }); } catch (Exception ex) { _logger?.LogError(ex, "Error fetching homepasses."); return(new ResponseMessage { Status = "Error", Message = "Error fetching homepasses." }); } }