Beispiel #1
0
        public IActionResult EditModel(string TempName, string TempTable, string TempType, string ModelOrgId, string JsonData, string ModelIndex)
        {
            string urlContentPath = @"\Content\" + ModelOrgId + @"\" + TempName + ".xml";
            var    modeltemp      = new ModelTempDto()
            {
                TempName    = TempName,
                TempTable   = TempTable,
                ModelOrgId  = ModelOrgId,
                TempType    = TempType,
                Id          = ModelIndex,
                ContentPath = urlContentPath
            };
            string urlPath = _hostEnvironment.WebRootPath;

            urlContentPath = urlPath + urlContentPath;
            List <ModelEntityDto> listDto = JsonConvert.DeserializeObject <List <ModelEntityDto> >(JsonData);

            OtherHelper.CreateListXml <ModelEntityDto>(urlContentPath, listDto);



            _tempService.Add(modeltemp);


            List <ModelEntityDto> list = OtherHelper.SerialierList <ModelEntityDto>(urlContentPath);

            return(Json(new JsonResult <string>
            {
                msg = "模板保存成功!", flag = true
            }));
        }
Beispiel #2
0
        public async Task <IActionResult> GetXmlData(string id)
        {
            var temp = await _tempService.Find(id);

            string urlContendPath = _hostEnvironment.WebRootPath + temp.ContentPath;

            List <ModelEntityDto> list = OtherHelper.SerialierList <ModelEntityDto>(urlContendPath);

            return(Json(list));
        }