public virtual ActionResult SaveDoc(IEnumerable<HttpPostedFileBase> attachments) { foreach (var uploadfile in attachments) { var newdoc = new KBDoc(); newdoc.CreatedBy = User.Identity.Name.Trim(); newdoc.CreatedOn = DateTime.Now; // string mimeType = uploadfile.ContentType; newdoc.KbDocName = Path.GetFileNameWithoutExtension(uploadfile.FileName); newdoc.FilePath = _fileStore.SaveUploadedFile(uploadfile); // newdoc.FileType = mimeType; _entities.AddToKBDocs(newdoc); _entities.SaveChanges(); } return Content(""); // return an empty string to signify success }
/// <summary> /// Deprecated Method for adding a new object to the KBDocs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToKBDocs(KBDoc kBDoc) { base.AddObject("KBDocs", kBDoc); }
/// <summary> /// Create a new KBDoc object. /// </summary> /// <param name="kbId">Initial value of the KbId property.</param> public static KBDoc CreateKBDoc(global::System.Int32 kbId) { KBDoc kBDoc = new KBDoc(); kBDoc.KbId = kbId; return kBDoc; }