title: download pdf files stored in database in mvc3
body: <p>I store few pdf files in my db as binary format using the below code in my controller,</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Index(HttpPostedFileBase file)
      {
          Image newImage = new Image();
          newImage.MimeType = file.ContentType;          
  
          var binaryReader = new BinaryReader(file.InputStream);
          newImage.Data = binaryReader.ReadBytes(file.ContentLength);
          binaryReader.Close();
          objImage.InsertImage(newImage.Data);
  
          return View();
  
      }
  </code></pre>
  
  <p>now i want to download them back based on the id passed to the contrller that pdf files should be downloaded??</p>
  
  <p>this is my code for pdf download, wat do i need to add more</p>
  
  <pre><code>    public ActionResult Download(int id)
      {
          DataSet da = new DataSet();
  
          da = objImage.getUserImage(id);
          DataTable dt = new DataTable();
          dt = da.Tables[0];
          Byte[] imagedata=(Byte[])dt.Rows[0]["UsImage"];
  
  
  
      }
  </code></pre>