Пример #1
0
        public IEnumerable<BookItem> MapXmlToObject()
        {
            var results = new List<BookItem>();

            var doc = XDocument.Load(XmlPath);

            foreach(XElement element in doc.Root.Elements())
            {
                var tmp = new BookItem();

                tmp.Name = element.Attribute("name").Value;

                tmp.PublishingHouse = element.Attribute("PublishingHouse").Value;

                results.Add(tmp);
            }

            return results.OrderByDescending(x => x.Name).ToList();
        }
Пример #2
0
 public ActionResult AddBook(string name, string publishing)
 {
     var item = new BookItem { Name = name, PublishingHouse = publishing };
     return Json(ViewHelper.RenderRazorViewToString(this.ControllerContext, "~/Views/Book/BookPartial.cshtml", item));
 }