//[AdminAuthorize(Permissions = "admin.article.update")] public IActionResult Update(GetArticleDetailRequest request) { var article = _articleService.GetArticleDetail(request); if (article == null) { throw new AlertException("信息不存在,可能被删除"); } var articleModel = _articleService.GetArticleModelDetail(new Domain.Dtos.Articles.ArticleModels.GetArticleModelDetailRequest() { Id = article.ArticleTypeId }); if (articleModel == null) { throw new AlertException("找不到文章模型"); } var model = new Moz.Administration.Models.Articles.UpdateModel() { Article = article, ArticleModel = articleModel }; return(View("~/Administration/Views/Article/Update.cshtml", model)); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <returns></returns> public GetArticleDetailResponse GetArticleDetail(GetArticleDetailRequest request) { using (var client = DbFactory.CreateClient()) { var article = client.Queryable <Article>().InSingle(request.Id); if (article == null) { return(null); } var resp = new GetArticleDetailResponse(); resp.Id = article.Id; resp.ArticleTypeId = article.ArticleTypeId; resp.CategoryId = article.CategoryId; resp.Title = article.Title; resp.SubTitle = article.SubTitle; resp.TitleColor = article.TitleColor; resp.TitleBold = article.TitleBold; resp.Summary = article.Summary; resp.Content = article.Content; resp.Tags = article.Tags; resp.ThumbImage = article.ThumbImage; resp.Video = article.Video; resp.Source = article.Source; resp.Author = article.Author; resp.Hits = article.Hits; resp.Addtime = article.Addtime; resp.OrderIndex = article.OrderIndex; resp.IsTop = article.IsTop; resp.IsRecommend = article.IsRecommend; resp.SeoTitle = article.SeoTitle; resp.SeoKeyword = article.SeoKeyword; resp.SeoDescription = article.SeoDescription; resp.String1 = article.String1; resp.String2 = article.String2; resp.String3 = article.String3; resp.String4 = article.String4; resp.Int1 = article.Int1; resp.Int2 = article.Int2; resp.Int3 = article.Int3; resp.Int4 = article.Int4; resp.Decimal1 = article.Decimal1; resp.Decimal2 = article.Decimal2; resp.Decimal3 = article.Decimal3; resp.Decimal4 = article.Decimal4; resp.Datetime1 = article.Datetime1; resp.Datetime2 = article.Datetime2; resp.Datetime3 = article.Datetime3; resp.Datetime4 = article.Datetime4; resp.Bool1 = article.Bool1; resp.Bool2 = article.Bool2; resp.Bool3 = article.Bool3; resp.Bool4 = article.Bool4; resp.Text1 = article.Text1; resp.Text2 = article.Text2; resp.Text3 = article.Text3; resp.Text4 = article.Text4; return(resp); } }