Пример #1
0
        public ActionResult GetHtmlFromPage(string pageUrl)
        {
            WebClient wc = new WebClient();
            byte[] raw = wc.DownloadData(pageUrl);

            string webData = System.Text.Encoding.UTF8.GetString(raw);
            var template =
                 new TemplateModel
                 {
                     title = "t",
                     src = webData,
                     description = "d"
                 };
            return Json(template, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
 private List<TemplateModel> GetTemplatesList()
 {
     IList<WebTemplate> templatesDB = WebTemplateRepository.GetAll().ToList();
     List<TemplateModel> templates = new List<TemplateModel>();
     foreach (var item in templatesDB)
     {
         var template =
              new TemplateModel
              {
                  title = item.Name,
                  src = string.Format(_getTemplateQuery, item.Id),
                  description = item.Name
              };
         templates.Add(template);
     }
     return templates;
 }