public async Task <GetNegotiationplanrouteCFsManagementDto> getNegotiationplanrouteCFsManagement(int pageNo, string filter, int parentId, string parentTitle) { if (parentId == 0) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } GetNegotiationplanrouteCFsManagementDto oGetNegotiationplanrouteCFsManagementDto = await _NegotiationplanrouteCFService.getNegotiationplanrouteCFsManagement(new GridChildInitialDto { recordCountPerPage = Setting.RECORD_COUNT_PAGE, pageNo = pageNo, filter = filter, userId = Setting.payloadDto.userId, parentId = parentId, parentTitle = parentTitle }); if (oGetNegotiationplanrouteCFsManagementDto == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } return(oGetNegotiationplanrouteCFsManagementDto); }
public async Task <GetNegotiationplanrouteCFsManagementDto> getNegotiationplanrouteCFsManagement(GridChildInitialDto gridInitialDto) { int pageNo = gridInitialDto.pageNo; if (gridInitialDto.pageNo < 1) { pageNo = 1; } IQueryable <NegotiationplanrouteCF> oNegotiationplanrouteCFs = _NegotiationplanrouteCFs.Include(i => i.carrier) .Include(i => i.forwarder) .Include(i => i.agent) .Where(i => i.negotiationplanrouteId == gridInitialDto.parentId).AsQueryable(); if (!string.IsNullOrEmpty(gridInitialDto.filter)) { oNegotiationplanrouteCFs = oNegotiationplanrouteCFs .Where(w => w.carrier.fullName.Contains(gridInitialDto.filter) == true); } int totalRecordCount = await oNegotiationplanrouteCFs.AsNoTracking().CountAsync(); GetNegotiationplanrouteCFsManagementDto oGetNegotiationplanrouteCFsManagementDto = new GetNegotiationplanrouteCFsManagementDto(); if (totalRecordCount != 0) { int totalPages = (int)Math.Ceiling((double)totalRecordCount / gridInitialDto.recordCountPerPage); if (pageNo > totalPages) { pageNo = totalPages; } oGetNegotiationplanrouteCFsManagementDto.getNegotiationplanrouteCFsDto = Mapper.Map <IEnumerable <NegotiationplanrouteCF>, List <GetNegotiationplanrouteCFsDto> > (await oNegotiationplanrouteCFs.GetPageRecords(pageNo, gridInitialDto.recordCountPerPage).ToListAsync()); oGetNegotiationplanrouteCFsManagementDto.currentPage = pageNo; oGetNegotiationplanrouteCFsManagementDto.totalRecordCount = totalRecordCount; } oGetNegotiationplanrouteCFsManagementDto.title = gridInitialDto.parentTitle; oGetNegotiationplanrouteCFsManagementDto.parent_ParentId = gridInitialDto.parentId; return(oGetNegotiationplanrouteCFsManagementDto); }