public bool DeleteDocument(Document doc) { try { CurLesson.Documents.Remove(doc); Helper.Session.DbContext.Delete(doc); return true; } catch { //An error occured while deleted the document record return false; } }
/// <summary> /// Add a document to the current lesson /// </summary> /// <param name="filename"></param> /// <param name="filepath"></param> /// <returns></returns> public Document AddDocument(string filename, string filepath) { try { Document newDoc = new Document(); newDoc.ID = Guid.NewGuid(); newDoc.Filename = filename; newDoc.FilePath = filepath; newDoc.Lessons.Add(CurLesson); CurLesson.Documents.Add(newDoc); NotifyPropertyChanged("Documents"); return newDoc; } catch { //An error occured while creating the new document return null; } }