// *********** Attchment ******************* public ActionResult NewAttechment(int id) { var attechmentVm = new AttchmentViewModel() { AssetEntryId = id }; return(PartialView("PartialViews/AssetEntrys/_attchmentPartialPage")); }
public JsonResult AttechmentSaveApi(AttchmentViewModel attchmentVm) { byte[] file = System.IO.File.ReadAllBytes(attchmentVm.File); ModelState.Remove("Id"); if (ModelState.IsValid) { //byte[] uploadedFile = new byte[attchmentVm.File.InputStream.Length]; //attchmentVm.File.InputStream.Read(uploadedFile, 0, uploadedFile.Length); var attchment = new Attchment() { AssetEntryId = attchmentVm.AssetEntryId, File = file }; int count = _attachmentManager.Add(attchment); return(Json(count, JsonRequestBehavior.AllowGet)); } return(Json(0, JsonRequestBehavior.AllowGet)); }