Asp.NETPersonnalBlogSystem/Article.aspx.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Web;
using Asp.NETPersonnalBlogSystem.BLL;
using Asp.NETPersonnalBlogSystem.Models;
namespace Asp.NETPersonnalBlogSystem
{
/// <summary>
/// 文章详情页
/// 显示文章内容和评论
/// </summary>
public partial class ArticlePage : System.Web.UI.Page
{
private ArticleService articleService = new ArticleService();
private CommentService commentService = new CommentService();
private int articleId = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!int.TryParse(Request.QueryString["id"], out articleId))
{
Response.Redirect("Default.aspx");
return;
}
if (!IsPostBack)
{
LoadArticle();
LoadComments();
}
}
/// <summary>
/// 加载文章内容
/// </summary>
private void LoadArticle()
{
var article = articleService.GetArticleById(articleId);
if (article == null || article.Status != 1)
{
Response.Redirect("Default.aspx");
return;
}
articleService.IncrementViewCount(articleId);
Page.Title = article.Title + " - " + Page.Title;
litTitle.Text = article.Title;
litCategory.Text = article.Category?.CategoryName;
litPublishTime.Text = article.PublishTime?.ToString("yyyy-MM-dd HH:mm");
litViewCount.Text = article.ViewCount.ToString();
litCommentCount.Text = article.CommentCount.ToString();
litLikeCount.Text = article.LikeCount.ToString();
divContent.InnerHtml = article.Content;
if (!string.IsNullOrEmpty(article.Tags))
{
string[] tags = article.Tags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
rptTags.DataSource = tags;
后面还有 129 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
