title: How to pass list values from an Action method to another in the same controller?
body: <p>How to pass data from a method to another inside a controller and display.
  The first method have list of values and this has to pass to the another and display that data from the view
   first action method:</p>
  
  <pre><code> [HttpPost]
   public ActionResult  matchpin(string id)
      {
          int d = Convert.ToInt32(id);
          List&lt;pin&gt; plist = new List&lt;pin&gt;();
          using (SqlConnection con = new SqlConnection(constring))
          {
              using (SqlCommand cmd = new SqlCommand("getpin", con))
              {
                  cmd.CommandType = CommandType.StoredProcedure;
  
                  cmd.Parameters.AddWithValue("@pin", d);
                  con.Open();
                  SqlDataReader reader = cmd.ExecuteReader();
                  while (reader.Read())
                  {
                      var pin = new pin()
                      {
                          // Vid=Convert.ToInt32(reader["Vid"]),
  
                          po = Convert.ToString(reader["po"]),
  
                      };
                      plist.Add(pin);
                  }
  
  
              }
          }
  
          return RedirectToAction("Index","home",new{ s =plist});
  
      }
  </code></pre>
  
  <p>second action method:</p>
  
  <pre><code> public ActionResult Index(List&lt;pin&gt; plist)
          {
  
             // return View();
              ViewBag.s = plist;
              return View("Index");
              //return new ContentResult { Content =TempData["Data"].ToString() };
  
          }
  </code></pre>