Пример #1
0
 public ActionResult List()
 {
     if (!User.IsInRole("SuperAdmin"))
     {
         ViewData["hidden"] = true;
     }
     return(View(HelperConnect.GetPeoples()));
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
 public void GetPeoples()
 {
     Assert.IsTrue(HelperConnect.GetPeoples().Count > 0);
 }