@{
var infoData=Html.InfoData();
int infoId =Html.CurrentInfoId();
int columnId=infoData.ColumnId;
//参数3和参数4分别为sql条件和sql参数
var prevData=Html.InfoDataPrevious(columnId,infoId,"columnId=@columnId",new{columnId=columnId});
var nextData=Html.InfoDataNext(columnId,infoId,"columnId=@columnId",new{columnId=columnId});
}
@{
CurrentUser currentUser=ViewBag.CurrentUser; //获取当前登录用户
int uid=currentUser.Uid; //获取用户Id,未登录uid为0
string userName=currentUser.UserName;//获取用户名
}
<div class="container padding-top-20">
<div class="row">
<div class="col-md-3">
@Html.Partial("subNavPartial")
</div>
<div class="col-md-9">
@Html.Partial("BreadcrumbPartial")
<div class="info-content">
<h4 class="text-center line-height-3">@infoData.Title</h4>
<div class="text-center">
<span title="发布时间" class="margin-right-20"><i class="fa fa-clock-o"></i> @infoData.Thedate.ToString("yyyy-MM-dd")</span>
<span title="点击数"><i class="fa fa-eye"></i> <span id="lb_clicks">0</span></span>
</div>
@{
if (uid == 0)
{
//未登录的逻辑
<div><br><a href="/member/login/"> <font color='blue'><center><u>已注册用户请登录后阅读受限内容</u></center></font></a> <br><center>
<a href="/member/reg/"> <font color='blue'><u>未注册者请注册新用户登陆后阅读</u></font></a></center> </div>
}
else
{
//已经登录的逻辑
<div><center>欢迎您,@currentUser.UserName !</center> @Html.Raw(infoData.Content)</div>
}
}
<div class="info-content padding-top-20" id="Content">
</div>
</div>
<div class="clearfix padding-top-20 line-height-2">
<ul>
@if (prevData != null)
{
string url = Html.InfoDataUrl((int)prevData.ColumnId, (int)prevData.Id);
<li class="text-gray">上一篇:<a href="@url">@prevData.Title</a></li>
}
@if (nextData != null)
{
string url = Html.InfoDataUrl((int)nextData.ColumnId, (int)nextData.Id);
<li class="text-gray">下一篇:<a href="@url">@nextData.Title</a></li>
}
</ul>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var $lb_clicks = $("#lb_clicks");
$.post("/E/InfoData/AddClicks", { ColumnId
infoData.ColumnId,Id
infoData.Id}, function (data) { $lb_clicks.text(data)})
</script>