Esempio n. 1
0
 /// <summary>
 /// Creates a new document and returns the document key.
 /// </summary>
 /// <param name="path">The path of the .aspx page or control containing the document.</param>
 /// <returns></returns>
 public static IDocumentInfo Create(string path)
 {
     using (var db = new Silversite.Context()) {
         var doc = new Document { Author = null, Path = path, Domain = Domains.Current };
         db.Documents.Add(doc);
         db.SaveChanges();
         doc.ContentKey = doc.Key;
         doc.Revision = 1;
         return doc;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Copies the document for storing as old version of the document.
 /// </summary>
 /// <returns></returns>
 public Document Old()
 {
     var old = new Document();
     CopyInfo(this, old);
     old.Path = Path;
     old.Domain = Domain;
     old.Text = Text;
     old.IsCurrentRevision = false;
     return old;
 }