MVC5 Razor Upload Image
<p>I'm trying to create a page that whilst editing an "Asset" the user can upload a picture within a partial view.</p>

<p>On submitting the picture I would like the filename to be saved to server location and prefixed with its Asset ID number for obvious reasons and then return the partial view but with the picture in. </p>

<p>So when the user submits the edit page the changed details as well as a new shiny picture url is saved to the DB.</p>

<p>Heres what I have so far.</p>

<p>Edit View (<strong>Edit.cshtml</strong>)</p>

<pre><code>@model Asset_Manager.DB.Asset

@{
    ViewBag.Title = "Edit";
}

&lt;h2&gt;Edit&lt;/h2&gt;

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()

    &lt;div class="form-horizontal"&gt;
        &lt;h4&gt;Asset&lt;/h4&gt;
        &lt;hr /&gt;
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        @Html.HiddenFor(model =&gt; model.Aid)
        **** other fields
        &lt;div class="form-group"&gt;
            @Html.LabelFor(model =&gt; model.Picture_Location, htmlAttributes: new { @class = "control-label col-md-2" })
            &lt;div class="col-md-10"&gt;
                @Html.Partial("~/Views/Asset/UploadAssetImage.cshtml",Model)
            &lt;/div&gt;
        &lt;/div&gt;
}

&lt;div&gt;
    @Html.ActionLink("Back to List", "Index")
&lt;/div&gt;

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
</code></pre>

<p>Partial Upload View (<strong>UploadAssetImage.cshtml</strong>)</p>

<pre><code>@model Asset_Manager.DB.Asset

@using (Html.BeginForm("UploadPicture", "Asset", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    &lt;img src="@Model.Picture_Location" alt="@Model.Description" width="250" height="250" /&gt;&lt;br /&gt;
    &lt;input type="file" name="file" /&gt;
    &lt;input type="submit" name="Submit" id="Submit" value="Upload" /&gt;
    &lt;input type="hidden" name="id" value="@Model.Aid" /&gt;
}
</code></pre>

<p>and finally Controller Method (<strong>AssetController.cs</strong>)</p>

<pre><code>[HttpPost]
public ActionResult UploadPicture(int id,FormCollection collection)
{
    if (Request.Files.Count &gt; 0)
    {
        var file = Request.Files[0];

        if (file != null &amp;&amp; file.ContentLength &gt; 0)
        {
            var fileName = "Asset_" + id + "_" + Path.GetFileName(file.FileName);
            var path = Path.Combine(Server.MapPath("~/Content/AssetImages/"), fileName);
            file.SaveAs(path);
        }
    }

    Asset A = new Asset();

    A = _dal.GetAssetByID(id);


    return PartialView("UploadAssetImage", A.Aid);

}
</code></pre>

<p>Now My Issues</p>

<p>Each time I try to submit a photo I get kicked right out to the Asset index (<strong>Index.cshtml</strong>) page let alone be able to see if sending the entire edit works. </p>

<p>Also the breakpoint under the controller method doesn't trigger so I cant trace where the issue could be.</p>

<p>Any Help / Examples / Pointers in the right direction would be appreciated.</p>