public ActionResult List() { if (!User.IsInRole("SuperAdmin")) { ViewData["hidden"] = true; } return(View(HelperConnect.GetPeoples())); }
public void Create(HttpServerUtilityBase Server) { var peoples = HelperConnect.GetPeoples(); var json = JsonConvert.SerializeObject(peoples, new JsonSerializerSettings()); using (var sw = new StreamWriter(Server.MapPath("~/files/peoples.json"), false, Encoding.Default)) { sw.WriteLine(json); } }
public void Create(HttpServerUtilityBase Server) { var peoples = HelperConnect.GetPeoples(); var settings = new XmlWriterSettings { Indent = true }; using (var writer = XmlWriter.Create(Server.MapPath("~/files/peoples.xml"), settings)) { writer.WriteStartElement("Peoples"); peoples.ForEach((people) => { writer.WriteStartElement("People"); people.WriteXml(writer); writer.WriteEndElement(); }); writer.WriteEndElement(); } }
public void GetPeoples() { Assert.IsTrue(HelperConnect.GetPeoples().Count > 0); }