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)); }
public HttpResponseMessage GetPersonal(HttpRequestMessage request, int Id) { Personal personal = personalRepo.GetWithoutTracking().Where(a => a.PersonalID == Id && a.IsDeleted == false).FirstOrDefault(); return(Request.CreateResponse(HttpStatusCode.OK, personal)); }