Exams/Controllers/PingController.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Exams.Models;
using Exams.Repository;
namespace Exams.Controllers
{
public class PingController : Controller
{
PingRepository _ping = new PingRepository();
public JsonResult PingList(string key, int rows = 20, int page = 1)
{
int count = 0;
List<object> list = _ping.GetPageList(rows, page, out count,key);
return Json(new { total = count, rows = list }, JsonRequestBehavior.AllowGet);
}
public JsonResult SavePing(string name, string content) {
Ping model = new Ping();
model.UName = name;
model.AddTime = DateTime.Now;
model.UContent = content;
model.UIP = Utils.Common.GetUserIP();
if (_ping.Add(model) != null)
return Json(new { status = "success", mess = "评论成功" }, "text/plain", JsonRequestBehavior.AllowGet);
else
return Json(new { status = "error", mess = "评论失败" }, "text/plain", JsonRequestBehavior.AllowGet);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
