public void ExportSuperheroesXml(SuperheroesXmlModel superheroes, string fileName) { string path = "../../../../03. Xml Files"; Directory.CreateDirectory(path); using (var stream = File.Create($"{path}/{fileName}.xml")) { var xmlSerializer = new XmlSerializer(typeof(SuperheroesXmlModel)); xmlSerializer.Serialize(stream, superheroes); } }
public string ExportSupperheroesWithPower(string power) { var data = this.dataGenrator.FillWithSuperheroesData(power); var superheroes = new SuperheroesXmlModel { Superheroes = data }; this.exporter.ExportSuperheroesXml(superheroes, "SuperheroesWithSpecificPower"); return($"All superheroes with {power} power xml created."); }
public string ExportSuperheroDetails(object superheroId) { var data = this.dataGenrator.FillWithSuperheroesData(superheroId); var superheroes = new SuperheroesXmlModel { Superheroes = data }; this.exporter.ExportSuperheroesXml(superheroes, "SuperheroWithSpecificId"); return($"Superhero with {superheroId} id xml created."); }
public string ExportAllSuperheroes() { var data = this.dataGenrator.FillWithSuperheroesData(); var superheroes = new SuperheroesXmlModel { Superheroes = data }; this.exporter.ExportSuperheroesXml(superheroes, "All Superheroes"); return("All superheroes xml created."); }
public string ExportSuperheroesByCity(string cityName) { bool justToOverrideTheMethod = true; var data = this.dataGenrator.FillWithSuperheroesData(cityName, justToOverrideTheMethod); var superheroes = new SuperheroesXmlModel { Superheroes = data }; this.exporter.ExportSuperheroesXml(superheroes, "SuperheroesWithSpecificCity"); return($"All superheroes with {cityName} city xml created."); }