Example #1
0
 /// <summary>
 /// Add a document to the database
 /// </summary>
 /// <param name="name">The name of the document</param>
 /// <param name="userId">The id of the user who created the document</param>
 /// <param name="filepath">The path to the file</param>
 /// <returns>The id of the created document</returns>
 public int AddDocument(String name, int userId, String directoryPath)
 {
     using (PieFactoryEntities context = new PieFactoryEntities())
     {
         Document document = new Document();
         document.name = name;
         document.creatorId = userId;
         document.creationTime = DateTime.UtcNow;
         document.path = directoryPath;
         context.Documents.AddObject(document);
         context.SaveChanges();
         return document.id;
     }
 }
Example #2
0
 /// <summary>
 /// Create a new Document object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="path">Initial value of the path property.</param>
 /// <param name="creationTime">Initial value of the creationTime property.</param>
 /// <param name="creatorId">Initial value of the creatorId property.</param>
 public static Document CreateDocument(global::System.Int32 id, global::System.String name, global::System.String path, global::System.DateTime creationTime, global::System.Int32 creatorId)
 {
     Document document = new Document();
     document.id = id;
     document.name = name;
     document.path = path;
     document.creationTime = creationTime;
     document.creatorId = creatorId;
     return document;
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Documents EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDocuments(Document document)
 {
     base.AddObject("Documents", document);
 }