//vrati pozadovanou verzi public void GetSelectedVersion(VersionEntity selectedVersion) { VersionEntityDB selectedVersionDB = new VersionEntityDB(selectedVersion.Name); VersionEntityDB foundVersionDB = versionsRepository.GetSelectedVersion(selectedVersionDB); SelectedVersion = new VersionEntity(foundVersionDB.Name); }
//vlozi data do Listu za ucelem ulozeni do souboru private List <VersionEntityDB> GetListOfRecords(VersionEntityDB versionToDB) { List <VersionEntityDB> records = new List <VersionEntityDB>(); records.Add(versionToDB); return(records); }
//vrati pozadovanou verzi public VersionEntityDB GetSelectedVersion(VersionEntityDB selectedVersion) { VersionEntityDB foundVersion = new VersionEntityDB(); List <VersionEntityDB> allVersions = GetAllVersions(); foundVersion = allVersions.Where(x => x.Name == selectedVersion.Name) .FirstOrDefault(); return(foundVersion); }
// ulozi novou verzi public string AddVersion(VersionEntityDB versionToDB) { List <VersionEntityDB> savedVersions = GetTodaysVersions(); savedVersions.Add(versionToDB); try { XmlSerializer serializer = new XmlSerializer(typeof(List <VersionEntityDB>)); using (StreamWriter streamWriter = new StreamWriter($"{path}/{fileName}")) { serializer.Serialize(streamWriter, savedVersions); } return(result = "Požadavek byl proveden"); } catch (Exception ex) { return(result = $"Požadavek nebyl proveden. Popis chyby: \n\n {ex.Message.ToString()}"); } }
// ulozeni nove verze public string AddVersion(VersionEntity versionToDB) { VersionEntityDB versionDB = new VersionEntityDB(versionToDB.Name); return(versionsRepository.AddVersion(versionDB)); }