using System; using System.Collections.Generic; using SlnMesnac.Model.domain; using SlnMesnac.Repository.service.@base; namespace SlnMesnac.Repository.service.ScanLog { public class ScanLogServiceImpl:BaseServiceImpl,IScanLogService { public ScanLogServiceImpl(Repository rep) : base(rep) { } public void CreatTable() { _rep.Context.CodeFirst.InitTables(); List ls = new List(); for (int i = 0; i < 100; i++) { ls.Add(new ScanLogModel() { CreateTime = DateTime.Now, DataType = 1, Rfid = "12", Code = "21", Ocr = "2", Url="badi.com" }); } this.Insert(ls); } public Page QueryPage(int pageIndex, int pageSize) { int totalCount = 0; var list= _rep.Context.Queryable().OrderByDescending(x => x.CreateTime) .ToPageList(pageIndex, pageSize, ref totalCount); Page page = new Page(); page.Data=list; page.PageIndex = pageIndex; page.PageSize = pageSize; page.TotalCount = totalCount; page.TotalPage = (int)Math.Ceiling(totalCount / (double)pageSize); return page; } } }