控制七

namespace 考勤项目.Controllers { public class clockingController : Controller { bllexam bll = new bllexam(); // GET: clocking [HttpPost] public int add(exam model) { return bll.add(model); } public ActionResult Index() { return View(); } //mvc接收显示方法 // JsonResult n = Json(bll.select().ToList(), JsonRequestBehavior.AllowGet); const int pageindex = 3; [HttpGet] public JsonResult getselect( string begintime, string endtime ,int page = 1) { //JsonResult n = Json(bll.select().ToList(), JsonRequestBehavior.AllowGet); List n = bll.select(); if (!string.IsNullOrWhiteSpace(begintime)) { var t = n.Where(m => m.begintime.Contains(begintime)).ToList(); } if (!string.IsNullOrWhiteSpace(endtime)) { var t = n.Where(m => m.begintime.Contains(endtime)).ToList(); } Page p = new Page(); p.pages = page; p.pagecount = (n.Count / pageindex) + (n.Count % pageindex == 0 ? 0 : 1); p.data = n.Skip((page - 1) * pageindex).Take(pageindex).ToList(); return Json(p, JsonRequestBehavior.AllowGet); } public ActionResult Show() { return View(); } public ActionResult manage() { return View(); } [HttpPost] public int SignIn(string time1) { string times = ConfigurationManager.AppSettings["Up"].ToString(); if (DateTime.Parse(time1) > DateTime.Parse(times)) { return 0; } else { return 1; } } [HttpPost] public int SignOut(string time2) { string times = ConfigurationManager.AppSettings["Down"].ToString(); if (DateTime.Parse(time2) < DateTime.Parse(times)) { return 0; } else { return 1; } } } }
原文地址:https://www.cnblogs.com/zongmf/p/10003256.html