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)); }
public bool Add(AttachmentInfo attachment) { return(dal.Add(attachment)); }