public async Task <GetNegotiationplanroutesManagementDto> getNegotiationplanroutesManagement(int pageNo, string filter, int parentId, string parentTitle) { if (parentId == 0) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } GetNegotiationplanroutesManagementDto oGetNegotiationplanroutesManagementDto = await _NegotiationplanrouteService.getNegotiationplanroutesManagement(new GridChildInitialDto { recordCountPerPage = Setting.RECORD_COUNT_PAGE, pageNo = pageNo, filter = filter, userId = Setting.payloadDto.userId, parentId = parentId, parentTitle = parentTitle }); if (oGetNegotiationplanroutesManagementDto == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } return(oGetNegotiationplanroutesManagementDto); }
public async Task <GetNegotiationplanroutesManagementDto> getNegotiationplanroutesManagement(GridChildInitialDto gridInitialDto) { int pageNo = gridInitialDto.pageNo; if (gridInitialDto.pageNo < 1) { pageNo = 1; } IQueryable <Negotiationplanroute> oNegotiationplanroutes = _Negotiationplanroutes.Include(i => i.fromLocation) .Include(i => i.toLocation) .Include(i => i.transporttype) .Where(i => i.negotiationplanId == gridInitialDto.parentId).AsQueryable(); if (!string.IsNullOrEmpty(gridInitialDto.filter)) { oNegotiationplanroutes = oNegotiationplanroutes .Where(w => w.fromLocation.locationName.Contains(gridInitialDto.filter) == true); } int totalRecordCount = await oNegotiationplanroutes.AsNoTracking().CountAsync(); GetNegotiationplanroutesManagementDto oGetNegotiationplanroutesManagementDto = new GetNegotiationplanroutesManagementDto(); if (totalRecordCount != 0) { int totalPages = (int)Math.Ceiling((double)totalRecordCount / gridInitialDto.recordCountPerPage); if (pageNo > totalPages) { pageNo = totalPages; } oGetNegotiationplanroutesManagementDto.getNegotiationplanroutesDto = Mapper.Map <IEnumerable <Negotiationplanroute>, List <GetNegotiationplanroutesDto> > (await oNegotiationplanroutes.GetPageRecords(pageNo, gridInitialDto.recordCountPerPage).ToListAsync()); oGetNegotiationplanroutesManagementDto.currentPage = pageNo; oGetNegotiationplanroutesManagementDto.totalRecordCount = totalRecordCount; } oGetNegotiationplanroutesManagementDto.title = gridInitialDto.parentTitle; oGetNegotiationplanroutesManagementDto.parent_ParentId = gridInitialDto.parentId; return(oGetNegotiationplanroutesManagementDto); }