title: how to merge codes in c# with passing parameters?
body: <p>Is it possible to have this line</p>
  
  <pre><code>var newlist = listOrder.OrderBy(i =&gt; i.Date).ToList().GetRange(jtStartIndex, jtPageSize)
  </code></pre>
  
  <p>and this line of code together?</p>
  
  <pre><code>_repository.ReportRepository.GetTracks(jtStartIndex, jtPageSize, jtSorting);
  </code></pre>
  
  <p>I tried by adding an Operator but it doesn't work. i.e. like this:</p>
  
  <pre><code>var newlist = listOrder.OrderBy(i =&gt; i.Date).ToList().GetRange(jtStartIndex, jtPageSize) + _repository.ReportRepository.GetTracks(jtStartIndex, jtPageSize, jtSorting);
  </code></pre>
  
  <p>Full Controller Code:</p>
  
  <pre><code>[HttpPost]
          public JsonResult StudentList(string StartDate = "", string EndDate = "", int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
          {
  
              try
          {
  
              if (Request.IsAuthenticated == true)
              {
                  string Path = @"C:\\5Newwithdate-1k.xls";
                  OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '" + Path + "';Extended Properties=" + (char)34 + "Excel 8.0;IMEX=1;" + (char)34 + "");
                  OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con);
                  con.Close();
                  System.Data.DataTable data = new System.Data.DataTable();
                  da.Fill(data);
  
                  List&lt;TopPlayed&gt; daa = new List&lt;TopPlayed&gt;();
                  foreach (DataRow p in data.Rows)
                  {
                      TopPlayed top = new TopPlayed()
                      {
                          TrackID = Convert.ToInt32(p.Field&lt;double&gt;("TrackID")),
                          Date = p.Field&lt;DateTime&gt;("DateTimes"),
                          TrackName = p.Field&lt;string&gt;("TrackName"),
                          ArtistName = p.Field&lt;string&gt;("ArtistName"),
                          Times = Convert.ToInt32(p.Field&lt;double&gt;("Times"))
                      };
  
                      daa.Add(top);
                  }
  
                  // var newlist = listOrder.OrderBy(i =&gt; i.Date).ToList().GetRange(jtStartIndex, jtPageSize) _repository.ReportRepository.GetTracks(jtStartIndex, jtPageSize, jtSorting);
  
                  var newlist = _repository.ReportRepository.GetTracks(jtStartIndex, jtPageSize, jtSorting).OrderBy(i =&gt; i.Date).ToList().GetRange(jtStartIndex, jtPageSize);
  
                  return Json(new { Result = "OK", Records = newlist, TotalRecordCount = daa.Count });
  </code></pre>