C# 刷新页面浏览次数(点击量)+1
页面视图:
<p class="text-center text-muted">文章来源:@ent.Origin 点击量:@ent.Hits <Script Language="Javascript" Src="/Web/UpdateClick/@ent.Id"></Script> 日期:@ent.CreateDate </p>
控制器代码:
public ActionResult UpdateClick(int Id) { var entity = DataFactory.Database().FindEntity<SitesDetails>(Id); DataFactory.Database().Update<SitesDetails>(Id, "Hits", entity.Hits + 1); return Content((entity.Hits + 1).ToString()); }