示例#1
0
 protected override void Dispose(bool disposing)
 {
     if (_dbContext != null)
     {
         _dbContext.Dispose();
     }
     base.Dispose(disposing);
 }
示例#2
0
        public HttpResponseMessage list(HttpRequestMessage request, int pagesize = 2, int page = 1)
        {
            List <Personal>            result     = personalRepo.GetWithoutTracking().Where(a => a.IsDeleted == false).ToList();
            var                        totalCount = result.Count();
            var                        totalpages = (int)Math.Ceiling((double)totalCount / pagesize);
            var                        dataList   = result.Skip(pagesize * (page - 1)).Take(pagesize);
            PagedListServer <Personal> model      = new PagedListServer <Personal>();

            model.Results    = dataList.ToList();
            model.TotalCount = totalCount;
            model.TotalPages = totalpages;
            dbContext.Dispose();
            return(request.CreateResponse <PagedListServer <Personal> >(HttpStatusCode.OK, model));
        }