Beispiel #1
0
        public ActionResult GetData(string filter, string value)
        {
            var path = ".\\Content\\search.xml";
            if (Url != null) path = Server.MapPath("~/Content/search.xml");

            var doc = XDocument.Load(path);
            var messageRepository = new MessageRepository(doc);

            var message = new Message();
            if (filter == "type") message.MessageType = value;
            if (filter == "county") message.County = value;

            var filteredList = messageRepository.GetFilteredList(message);

            doc.Element("searchresult").Element("result-array").Element("result").Element("messages").ReplaceAll(filteredList);
            return new XmlResult(doc);
        }
 private static MessageRepository CreateRepository()
 {
     var xdoc = XDocument.Load("Content\\search.xml");
     var messages = new MessageRepository(xdoc);
     return messages;
 }