<div class="form-group">
@Html.LabelFor(model => model.Picture, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
<img src="data:image/jpeg;base64,@Convert.ToBase64String(Model.Picture,78,Model.Picture.Length-78 ,
Base64FormattingOptions.None)"
alt="Image" />
<input type="file" name="ImageData" id="ImageData" />
div>
[HttpPost]
public ActionResult Edit(Category selectedc)
{ if (ModelState.IsValid)
{ if (Request.Files.Count > 0)
{ selectedc.Picture = new byte[Request.Files[0].ContentLength];
Request.Files[0].InputStream.Read(selectedc.Picture, 0, Request.Files[0].ContentLength);
} dbNorthwindEntities db = new dbNorthwindEntities();
Category updatedc = db.Categories.Single(c => c.CategoryID == selectedc.CategoryID);
updatedc.CategoryID = selectedc.CategoryID;
updatedc.CategoryName = selectedc.CategoryName;
updatedc.Description = selectedc.Description;
updatedc.Picture = selectedc.Picture;
db.SaveChanges();
// return RedirectToAction("Index", new {id = selectedc})
return RedirectToAction("Index");
} return View();
}