public PageResult <ViewInterestedClass> Interests(int userId, int page, int size) { var iquery = _repository.Interests().Where(c => c.UserId == userId).OrderBy(c => c.CreateTime); PageResult <ViewInterestedClass> pr = new PageResult <ViewInterestedClass>(0, "", page, size, iquery.Count(), new List <ViewInterestedClass>()); List <InterestedClass> list = iquery.Skip((page - 1) * size).Take(size).ToList(); foreach (var item in list) { item.Class.InterestedClass = null; } pr.Objects = (from c in list select new ViewInterestedClass() { Id = c.Id, ClassId = c.ClassId, CreateTime = c.CreateTime, Class = new Class() { Banner = c.Class.Banner, Name = c.Class.Name, Start = c.Class.Start, ClassStatus = c.Class.ClassStatus, Summary = c.Class.Summary } }).ToList(); return(pr); }