public ErrorCode Rename(Guid presentationUID, string name) { DBPresentation dbPresentation = new DBPresentation(); Presentation presentation = dbPresentation.Select(presentationUID).FirstOrDefault(); presentation.Name = name; if (dbPresentation.Update(presentation)) return ErrorCode.OK; return ErrorCode.ERROR; }
public ErrorCode Delete(Guid presentationUID) { DBPresentation dbPresentation = new DBPresentation(); List<Presentation> presentations = dbPresentation.Select(null); if (presentations.Count <= 1) return ErrorCode.MINIMALPRESENTATIONS; if (dbPresentation.Delete(presentationUID)) { string path = Path.Combine(presentationsFolder, presentationUID.ToString()); if (Directory.Exists(path)) Directory.Delete(path, true); return ErrorCode.OK; } return ErrorCode.ERROR; }
public ErrorCode CreateNew(Guid templateUID, out Guid newPresentationUID, string name) { newPresentationUID = Guid.Empty; if (templateUID == Guid.Empty || String.IsNullOrEmpty(name)) return ErrorCode.ERROR; // Template aus der DB laden DBPresentation dbPresentation = new DBPresentation(); List<Presentation> templates = dbPresentation.Select(templateUID); if (templates == null || templates.Count == 0) return ErrorCode.ERROR; Presentation template = templates.FirstOrDefault(); // copy files newPresentationUID = Guid.NewGuid(); CopyDirectory(new DirectoryInfo(Path.Combine(PresentationsFolder, templateUID.ToString())), new DirectoryInfo(Path.Combine(PresentationsFolder, newPresentationUID.ToString()))); return CreateNew(newPresentationUID, name, template.Type); }