Exemplo n.º 1
0
        public IActionResult Edit(Guid ID)
        {
            ViewBag.LangList = _languageTypeAppService.QueryList(a => a.ID != Guid.Empty);
            ArticleTypeDto currModel = _ArticleTypeAppService.Get(ID);

            return(View(currModel));
        }
Exemplo n.º 2
0
        public JsonResult InitData(int j = 1)
        {
            Vic.Core.Utils.Spider.DotNetDocHelper doc = new Vic.Core.Utils.Spider.DotNetDocHelper();
            var data = doc.InitDotNetDocHelper(j);

            if (data.Any())
            {
                var langID = _languageTypeAppService.List().FirstOrDefault().ID;
                //_languageTypeAppService.Create(new LanguageTypeDto()
                //{
                //    ID = langID,
                //    Code = "zh-CN",
                //    Images = "https://wx1.sinaimg.cn/large/006WIu6sgy1fjslc61hrtj30rs0fmtbj.jpg",
                //    Title = "中文",
                //    CreateTime = DateTime.Now,
                //    LastUpdateTime = DateTime.Now,
                //    LastUpdateUserID = Vic.Core.Utils.ConstDefine.SuperAdminID,
                //    CreatorID = Vic.Core.Utils.ConstDefine.SuperAdminID
                //});
                var articleType = _articleTypeAppService.Get(a => a.SerialNumber == j);
                //var exists = _articleAppService.Get(a => a.ArticleTypeID == articleType.ID);
                //if (exists != null)
                //{
                //    return Json("exists");
                //}
                foreach (var item in data)
                {
                    if (string.IsNullOrEmpty(item.content))
                    {
                        continue;
                    }
                    //_articleTypeAppService.Create(new ArticleTypeDto()
                    //{
                    //    ID = Guid.NewGuid(),
                    //    SerialNumber = i,
                    //    Title = item.title,
                    //    Url = item.cover,
                    //    LanguageTypeID = langID,
                    //    LanguageTypeName = "中文",
                    //    Images = "https://wx1.sinaimg.cn/large/006WIu6sgy1fjslc61hrtj30rs0fmtbj.jpg",
                    //    CreateTime = DateTime.Now,
                    //    LastUpdateTime = DateTime.Now,
                    //    LastUpdateUserID = Vic.Core.Utils.ConstDefine.SuperAdminID,
                    //    CreatorID = Vic.Core.Utils.ConstDefine.SuperAdminID
                    //});
                    int count = _articleAppService.Count(a => a.Title == item.title);
                    if (count > 0)
                    {
                        continue;
                    }
                    _articleAppService.Create(new ArticleDto()
                    {
                        //ID = Guid.NewGuid(),
                        Title            = item.title,
                        ArticleTypeID    = articleType.ID,
                        ArticleTypeName  = articleType.Title,
                        Author           = "gaoby.cn",
                        BrowseNum        = 101,
                        Content          = item.content,
                        Description      = item.content.Length > 500 ? item.content.Substring(0, 500) : item.content,
                        PublishDate      = DateTime.Now,
                        Remark           = "",
                        SeoTitle         = item.title,
                        Source           = item.cover,
                        LanguageTypeID   = langID,
                        LanguageTypeName = "中文",
                        Images           = "https://wx1.sinaimg.cn/large/006WIu6sgy1fjslc61hrtj30rs0fmtbj.jpg",
                        CreateTime       = DateTime.Now,
                        LastUpdateTime   = DateTime.Now,
                        LastUpdateUserID = Vic.Core.Utils.ConstDefine.SuperAdminID,
                        CreatorID        = Vic.Core.Utils.ConstDefine.SuperAdminID
                    });
                }
            }
            return(Json("ok"));
        }