title: Upload/download pdf files in SQL Server using mvc 2010
body: <p>I've been learning on my own how to program in <strong>c#</strong> with <strong>mvc 2010 Express</strong>, as I've been asked to create an application for the company I work for.
  The last thing I have to do is allow the users to <strong>upload and download a pdf</strong> file and I can't find a solution that helps me.</p>
  
  <p>I use <strong>SQL Server 2005</strong>. The table I want to use is called <code>Clients</code>. It has an <code>Id</code> as the primary key. Should I create an attribute to store the pdf as a binary file? Or how?</p>
  
  <p>To upload the pdf I have a link in my view that redirects the user to another view (named Upload) with the <code>id</code> of the client. The controller name is <code>Home</code>, so the user will see something like:</p>
  
  <pre><code>Home.aspx/Upload/2
  </code></pre>
  
  <p>There, I want the user to be able to select the pdf he wants to upload and then click the button to upload it. So the controller will handle it with the <code>[HttpPost]</code>.</p>
  
  <p>To edit a client it was pretty straight forward, as I created Model Views in the folder ViewModels and then passed them to the controller.
  But <strong>how can I pass to the controller both the <code>id</code> and the pdf file?</strong> I need the <code>id</code> to know what user is that. And <strong>how can I store the pdf in my table <code>Clients</code> in SQL Server?</strong>
  And then <strong>how can I download the pdf?</strong></p>