示例#1
0
 public int Add(clockrecord cc)
 {
     using (var ctx = new oneallEntities())
     {
         ctx.clockrecord.Add(cc);
         return(ctx.SaveChanges());
     }
 }
示例#2
0
 public ActionResult Get()
 {
     using (var ctx = new oneallEntities())
     {
         IQueryable <clockrecord> queryable = ctx.clockrecord;
         var json = queryable.ToList().Select(x => new
         {
             id       = x.id,
             createat = x.createat.Value.ToString("yyyy-MM-dd HH:mm:ss"),
             location = x.location
         });
         return(Json(json, JsonRequestBehavior.AllowGet));
     }
 }
示例#3
0
 public ActionResult List(int page, int pagesize)
 {
     using (var ctx = new oneallEntities())
     {
         IQueryable <clockrecord> queryable = ctx.clockrecord.OrderByDescending(m => m.id).Skip((page - 1) * pagesize < 0 ? 0 : (page - 1) * pagesize).Take(pagesize);
         var json = queryable.ToList().Select(x => new
         {
             id       = x.id,
             createat = x.createat.Value.ToString("yyyy-MM-dd HH:mm:ss"),
             location = x.location,
             describe = x.describe
         });
         return(Json(json, JsonRequestBehavior.AllowGet));
     }
 }