title: HttpPostedFileBase to varbinary(max)
body: <p>I have just tried a lot of things that I found but at the end nothing successfull.</p>
  
  <p>First I have the next code that just do the things ok but dont save the image.</p>
  
  <p>What should I do to save an image into a varbinarymax? and how to show them to the view next?</p>
  
  <p>view:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
    @Html.LabelFor(model =&gt; model.Logo, htmlAttributes: new { @class = "control-label col-md-2" })
    &lt;div class="col-md-10"&gt;
      @*@Html.EditorFor(model =&gt; model.Logo, new { htmlAttributes = new { @class = "form-control" } })*@
      @Html.TextBoxFor(model =&gt; model.Logo, new { type = "file" })
      @Html.ValidationMessageFor(model =&gt; model.Logo, "", new { @class = "text-danger" })
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; Create([Bind(Include = "Id,Name,Address,Description,Mail,Phone,Small_Description")] School school)
  {
    if (ModelState.IsValid)
    {
      db.School.Add(school);
      await db.SaveChangesAsync();
      return RedirectToAction("Index");
    }
    return View(school);
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public partial class School
  {
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
    public School()
    {
      this.Product = new HashSet&lt;Product&gt;();
    }
  
    public int Id { get; set; }
    public string Name { get; set; }
    public string Address { get; set; }
    public string Description { get; set; }
    public string Mail { get; set; }
    public int? Phone { get; set; }
    public byte[] Logo { get; set; }
    public string Small_Description { get; set; }
  
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
    public virtual ICollection&lt;Product&gt; Product { get; set; }
  }
  </code></pre>