public ActionResult Partners() { Images p = new Images(); List<Images> Li = new List<Images>(); Li = p.IndexDisplay(); ViewData["IndexDisplay"] = Li; return View(Li); }
public List<Images> IndexDisplay() { SqlConnection con = new SqlConnection(constr); con.Open(); using (con) { SqlCommand cmd = new SqlCommand("Select * from ImageTable ",con); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { p = new Images(); p.Name = Convert.ToString(rd.GetSqlValue(1)); p.Image1 = (byte[])rd[2]; ImagesList.Add(p); } } return ImagesList; }